mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 21:20:03 +00:00
Performance Increase of Vector of Structures using .NET BlockCopy (#4830)
* Added Get<vector_name>Array() method for accessing vectors of structures in C# using Buffer.Blockcopy(). * Added Get<vector_name>Array() method for accessing vectors of structures in C# using Buffer.Blockcopy(). Added Create<Name>VectorBlock() method to add a typed array using Buffer.BlockCopy() to speed up creation of vector of arrays New Lua files for namespace test * fixed c++ style issue
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
6e185d06a7
commit
7b50004ec9
@@ -221,6 +221,16 @@ namespace FlatBuffers.Test
|
||||
}
|
||||
Assert.AreEqual(10, invsum);
|
||||
|
||||
// Get the inventory as an array and subtract the
|
||||
// sum to get it back to 0
|
||||
var inventoryArray = monster.GetInventoryArray();
|
||||
Assert.AreEqual(5, inventoryArray.Length);
|
||||
foreach(var inv in inventoryArray)
|
||||
{
|
||||
invsum -= inv;
|
||||
}
|
||||
Assert.AreEqual(0, invsum);
|
||||
|
||||
var test0 = monster.Test4(0).Value;
|
||||
var test1 = monster.Test4(1).Value;
|
||||
Assert.AreEqual(2, monster.Test4Length);
|
||||
|
||||
Reference in New Issue
Block a user