mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 23:21:38 +00:00
Remove byte* property in ByteBufferAllocator (#5191)
* Remove byte* property in ByteBufferAllocator. This allows consumers to read/write into native memory, but without having to always pin the managed `byte[]` when working with managed memory. This allows for users to not need to Dispose() ByteBuffers when they are using the default ByteArrayAllocator class. Instead, we use `Span<byte> GetSpan()` methods to get access to the underlying memory buffer. Fix #5181 * Add a set of benchmark tests. * Add ReadOnly spans. This allows consumers to use ReadOnlyMemory<byte> as the backing storage for ByteBuffers, which is useful in read-only scenarios. * Run tests using ENABLE_SPAN_T in appveyor. * Fix FlatBuffers.Test.csproj to work on older MSBuild versions. * Change the test script to test UNSAFE_BYTEBUFFER * Address PR feedback. Remove IDisposable from ByteBuffer. * Respond to PR feedback.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
bb58442054
commit
0cdacdfb35
21
tests/FlatBuffers.Benchmarks/FlatBuffers.Benchmarks.csproj
Normal file
21
tests/FlatBuffers.Benchmarks/FlatBuffers.Benchmarks.csproj
Normal file
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER;BYTEBUFFER_NO_BOUNDS_CHECK;ENABLE_SPAN_T</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.11.3" />
|
||||
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.11.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\net\FlatBuffers\*.cs" Link="FlatBuffers\%(FileName).cs" />
|
||||
<Compile Include="..\MyGame\**\*.cs" Link="MyGame\Example\%(FileName).cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user