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:
Derek Bailey
2018-07-26 13:44:40 -07:00
committed by Wouter van Oortmerssen
parent 6e185d06a7
commit 7b50004ec9
12 changed files with 625 additions and 16 deletions

View File

@@ -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);