Skip to content

Commit

Permalink
WIP: Codegen-free FASTER C# (#67)
Browse files Browse the repository at this point in the history
* Initial checkin

* Removed Key* from benchmarks

* Changed callback functions from static to object.

* Removed raw pointers to Value type.

* All user types are now ref-based.

* Generic version of FASTER compiles and works fine for blittable types, for in-memory operations. BasicFASTERTests test cases now pass. There is no performance regression for 50:50 read/upsert YCSB workload. ManagedSample1 is now based on generic FASTER. Support for non-blittable objects has not yet been added. Codegen fails - but can be ignored for now.

* Updates to support generic version

* Updates to refactor allocator

* Testing alt allocator structure

* Fully working generic support, still needs cleanup

* Fixed multi-threading bug with generic allocator.

* Further updates, object recovery not yet passing.

* Fixes to generic object recovery. All tests pass! Cleanup still pending.

* Update samples

* More cleanup and refactoring

* More cleanup and code cutting.

* Heavy simplification of user API and interfaces.

* Removed InitialValueLength from user callback functions

* Updating AddressInfo calculation for AnyCPU 32-bit compat. Other cleanup.

* Cleanup of inlining directives

* Changing key comparer to use a separate IFasterEqualityComparer<T> interface. Now, there are no interface restrictions or requirements on any of the FASTER key/value types.

* Cleanup, simplification, updates. Persistence API cleaned up as well.

* Simplifying Guid determination for persistence callback.

* Fixing test break in AnyCPU-Debug due to different struct layout.

* Fixing the checkpointing directory settings and log creation and initialization code.
  • Loading branch information
badrishc authored Dec 14, 2018
1 parent 0fbb535 commit 54f23a4
Show file tree
Hide file tree
Showing 139 changed files with 5,432 additions and 8,569 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,5 @@ packages/
*.VC.opendb
.vs/
*.lib
nativebin/
nativebin/
/cs/benchmark/Properties/launchSettings.json
112 changes: 45 additions & 67 deletions cs/FASTER.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,31 @@ VisualStudioVersion = 15.0.27004.2008
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FASTER.benchmark", "benchmark\FASTER.benchmark.csproj", "{33A732D1-2B58-4FEE-9696-B9483496229F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FASTER.test", "test\FASTER.test.csproj", "{0DC7F5A2-E963-4E7F-BD37-6F7864B726F2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FASTER.test", "test\FASTER.test.csproj", "{0DC7F5A2-E963-4E7F-BD37-6F7864B726F2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "playground", "playground", "{E6026D6A-01C5-4582-B2C1-64751490DABE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedSample1", "playground\ManagedSample1\ManagedSample1.csproj", "{17BDD0A5-98E5-464A-8A00-050D9FF4C562}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmark", "benchmark", "{CA6AB459-A31A-4C15-B1A6-A82C349B54B4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{81B3B5D1-70F6-4979-AC76-003F9A6B316B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedSample2", "playground\ManagedSample2\ManagedSample2.csproj", "{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedSample3", "playground\ManagedSample3\ManagedSample3.csproj", "{3E571C7C-59B5-485C-AC78-3F34D3511CD2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SumStore", "playground\SumStore\SumStore.csproj", "{05D61B37-9714-4234-9961-384A63F7175E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedSample4", "playground\ManagedSample4\ManagedSample4.csproj", "{E1AC9797-ABE3-4881-A51B-37D8687AAE35}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SumStore", "playground\SumStore\SumStore.csproj", "{05D61B37-9714-4234-9961-384A63F7175E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassCache", "playground\ClassCache\ClassCache.csproj", "{10FD4868-BB16-442B-B0AC-18AE278D9C60}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NestedTypesTest", "playground\NestedTypesTest\NestedTypesTest.csproj", "{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{28800357-C8CE-4CD0-A2AD-D4A910ABB496}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{9531E3D2-217B-4446-98E8-E48F0FDD1452}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FASTER.core", "src\core\FASTER.core.csproj", "{F947BC6A-2943-4AC7-ACA7-F17351E25FE7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedSampleCore", "playground\ManagedSampleCore\ManagedSampleCore.csproj", "{C9391533-1F31-47F6-BE08-9642C95401A8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructSample", "playground\StructSample\StructSample.csproj", "{494703CF-C1C9-4800-B994-EF3974EB051D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructSampleCore", "playground\StructSampleCore\StructSampleCore.csproj", "{D938612F-4B99-409E-953E-28A3A027B0E3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassSample", "playground\ClassSample\ClassSample.csproj", "{18B6FB88-202F-4DAD-A582-17E1CEB873EC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MixedSample", "playground\MixedSample\MixedSample.csproj", "{8B9F682D-145C-4085-AD8A-845255597F5D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -59,30 +55,6 @@ Global
{0DC7F5A2-E963-4E7F-BD37-6F7864B726F2}.Release|Any CPU.Build.0 = Release|Any CPU
{0DC7F5A2-E963-4E7F-BD37-6F7864B726F2}.Release|x64.ActiveCfg = Release|x64
{0DC7F5A2-E963-4E7F-BD37-6F7864B726F2}.Release|x64.Build.0 = Release|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Debug|Any CPU.ActiveCfg = Debug|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Debug|Any CPU.Build.0 = Debug|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Debug|x64.ActiveCfg = Debug|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Debug|x64.Build.0 = Debug|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Release|Any CPU.ActiveCfg = Release|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Release|Any CPU.Build.0 = Release|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Release|x64.ActiveCfg = Release|x64
{17BDD0A5-98E5-464A-8A00-050D9FF4C562}.Release|x64.Build.0 = Release|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Debug|Any CPU.ActiveCfg = Debug|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Debug|Any CPU.Build.0 = Debug|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Debug|x64.ActiveCfg = Debug|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Debug|x64.Build.0 = Debug|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Release|Any CPU.ActiveCfg = Release|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Release|Any CPU.Build.0 = Release|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Release|x64.ActiveCfg = Release|x64
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486}.Release|x64.Build.0 = Release|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Debug|Any CPU.ActiveCfg = Debug|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Debug|Any CPU.Build.0 = Debug|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Debug|x64.ActiveCfg = Debug|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Debug|x64.Build.0 = Debug|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Release|Any CPU.ActiveCfg = Release|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Release|Any CPU.Build.0 = Release|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Release|x64.ActiveCfg = Release|x64
{3E571C7C-59B5-485C-AC78-3F34D3511CD2}.Release|x64.Build.0 = Release|x64
{05D61B37-9714-4234-9961-384A63F7175E}.Debug|Any CPU.ActiveCfg = Debug|x64
{05D61B37-9714-4234-9961-384A63F7175E}.Debug|Any CPU.Build.0 = Debug|x64
{05D61B37-9714-4234-9961-384A63F7175E}.Debug|x64.ActiveCfg = Debug|x64
Expand All @@ -91,14 +63,6 @@ Global
{05D61B37-9714-4234-9961-384A63F7175E}.Release|Any CPU.Build.0 = Release|x64
{05D61B37-9714-4234-9961-384A63F7175E}.Release|x64.ActiveCfg = Release|x64
{05D61B37-9714-4234-9961-384A63F7175E}.Release|x64.Build.0 = Release|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Debug|Any CPU.ActiveCfg = Debug|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Debug|Any CPU.Build.0 = Debug|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Debug|x64.ActiveCfg = Debug|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Debug|x64.Build.0 = Debug|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Release|Any CPU.ActiveCfg = Release|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Release|Any CPU.Build.0 = Release|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Release|x64.ActiveCfg = Release|x64
{E1AC9797-ABE3-4881-A51B-37D8687AAE35}.Release|x64.Build.0 = Release|x64
{10FD4868-BB16-442B-B0AC-18AE278D9C60}.Debug|Any CPU.ActiveCfg = Debug|x64
{10FD4868-BB16-442B-B0AC-18AE278D9C60}.Debug|Any CPU.Build.0 = Debug|x64
{10FD4868-BB16-442B-B0AC-18AE278D9C60}.Debug|x64.ActiveCfg = Debug|x64
Expand All @@ -107,14 +71,6 @@ Global
{10FD4868-BB16-442B-B0AC-18AE278D9C60}.Release|Any CPU.Build.0 = Release|x64
{10FD4868-BB16-442B-B0AC-18AE278D9C60}.Release|x64.ActiveCfg = Release|x64
{10FD4868-BB16-442B-B0AC-18AE278D9C60}.Release|x64.Build.0 = Release|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Debug|Any CPU.ActiveCfg = Debug|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Debug|Any CPU.Build.0 = Debug|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Debug|x64.ActiveCfg = Debug|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Debug|x64.Build.0 = Debug|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Release|Any CPU.ActiveCfg = Release|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Release|Any CPU.Build.0 = Release|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Release|x64.ActiveCfg = Release|x64
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786}.Release|x64.Build.0 = Release|x64
{F947BC6A-2943-4AC7-ACA7-F17351E25FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F947BC6A-2943-4AC7-ACA7-F17351E25FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F947BC6A-2943-4AC7-ACA7-F17351E25FE7}.Debug|x64.ActiveCfg = Debug|x64
Expand All @@ -123,31 +79,53 @@ Global
{F947BC6A-2943-4AC7-ACA7-F17351E25FE7}.Release|Any CPU.Build.0 = Release|Any CPU
{F947BC6A-2943-4AC7-ACA7-F17351E25FE7}.Release|x64.ActiveCfg = Release|x64
{F947BC6A-2943-4AC7-ACA7-F17351E25FE7}.Release|x64.Build.0 = Release|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Debug|Any CPU.ActiveCfg = Debug|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Debug|Any CPU.Build.0 = Debug|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Debug|x64.ActiveCfg = Debug|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Debug|x64.Build.0 = Debug|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Release|Any CPU.ActiveCfg = Release|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Release|Any CPU.Build.0 = Release|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Release|x64.ActiveCfg = Release|x64
{C9391533-1F31-47F6-BE08-9642C95401A8}.Release|x64.Build.0 = Release|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Debug|Any CPU.ActiveCfg = Debug|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Debug|Any CPU.Build.0 = Debug|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Debug|x64.ActiveCfg = Debug|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Debug|x64.Build.0 = Debug|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Release|Any CPU.ActiveCfg = Release|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Release|Any CPU.Build.0 = Release|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Release|x64.ActiveCfg = Release|x64
{494703CF-C1C9-4800-B994-EF3974EB051D}.Release|x64.Build.0 = Release|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Debug|Any CPU.ActiveCfg = Debug|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Debug|Any CPU.Build.0 = Debug|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Debug|x64.ActiveCfg = Debug|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Debug|x64.Build.0 = Debug|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Release|Any CPU.ActiveCfg = Release|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Release|Any CPU.Build.0 = Release|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Release|x64.ActiveCfg = Release|x64
{D938612F-4B99-409E-953E-28A3A027B0E3}.Release|x64.Build.0 = Release|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Debug|Any CPU.ActiveCfg = Debug|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Debug|Any CPU.Build.0 = Debug|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Debug|x64.ActiveCfg = Debug|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Debug|x64.Build.0 = Debug|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Release|Any CPU.ActiveCfg = Release|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Release|Any CPU.Build.0 = Release|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Release|x64.ActiveCfg = Release|x64
{18B6FB88-202F-4DAD-A582-17E1CEB873EC}.Release|x64.Build.0 = Release|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Debug|Any CPU.ActiveCfg = Debug|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Debug|Any CPU.Build.0 = Debug|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Debug|x64.ActiveCfg = Debug|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Debug|x64.Build.0 = Debug|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Release|Any CPU.ActiveCfg = Release|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Release|Any CPU.Build.0 = Release|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Release|x64.ActiveCfg = Release|x64
{8B9F682D-145C-4085-AD8A-845255597F5D}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{33A732D1-2B58-4FEE-9696-B9483496229F} = {CA6AB459-A31A-4C15-B1A6-A82C349B54B4}
{0DC7F5A2-E963-4E7F-BD37-6F7864B726F2} = {81B3B5D1-70F6-4979-AC76-003F9A6B316B}
{17BDD0A5-98E5-464A-8A00-050D9FF4C562} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{7DB87633-9CAB-4AE4-9ED0-AA6E77448486} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{3E571C7C-59B5-485C-AC78-3F34D3511CD2} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{05D61B37-9714-4234-9961-384A63F7175E} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{E1AC9797-ABE3-4881-A51B-37D8687AAE35} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{10FD4868-BB16-442B-B0AC-18AE278D9C60} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{2D5F23F7-3184-43EC-A7F1-C924F7FEF786} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{9531E3D2-217B-4446-98E8-E48F0FDD1452} = {28800357-C8CE-4CD0-A2AD-D4A910ABB496}
{F947BC6A-2943-4AC7-ACA7-F17351E25FE7} = {9531E3D2-217B-4446-98E8-E48F0FDD1452}
{C9391533-1F31-47F6-BE08-9642C95401A8} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{494703CF-C1C9-4800-B994-EF3974EB051D} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{D938612F-4B99-409E-953E-28A3A027B0E3} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{18B6FB88-202F-4DAD-A582-17E1CEB873EC} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
{8B9F682D-145C-4085-AD8A-845255597F5D} = {E6026D6A-01C5-4582-B2C1-64751490DABE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A0750637-2CCB-4139-B25E-F2CE740DCFAC}
Expand Down
22 changes: 7 additions & 15 deletions cs/benchmark/ConcurrentDictionaryBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#pragma warning disable 0162

//#define DASHBOARD
//#define USE_CODEGEN

using FASTER.core;
using System;
Expand Down Expand Up @@ -55,7 +54,6 @@ public enum Op : ulong
Key[] init_keys_;

Key[] txn_keys_;
Key* txn_keys_ptr;

long idx_ = 0;

Expand Down Expand Up @@ -135,9 +133,7 @@ private void RunYcsb(int thread_idx)
chunk_idx = Interlocked.Add(ref idx_, kChunkSize) - kChunkSize;
}

var local_txn_keys_ptr = txn_keys_ptr + chunk_idx;

for (long idx = chunk_idx; idx < chunk_idx + kChunkSize && !done; ++idx, ++local_txn_keys_ptr)
for (long idx = chunk_idx; idx < chunk_idx + kChunkSize && !done; ++idx)
{
Op op;
int r = (int)rng.Generate(100);
Expand All @@ -152,21 +148,21 @@ private void RunYcsb(int thread_idx)
{
case Op.Upsert:
{
store[*local_txn_keys_ptr] = value;
store[txn_keys_[idx]] = value;
++writes_done;
break;
}
case Op.Read:
{
if (store.TryGetValue(*local_txn_keys_ptr, out value))
if (store.TryGetValue(txn_keys_[idx], out value))
{
++reads_done;
}
break;
}
case Op.ReadModifyWrite:
{
store.AddOrUpdate(*local_txn_keys_ptr, *(Value*)(input_ptr + (idx & 0x7)), (k, v) => new Value { value = v.value + (input_ptr + (idx & 0x7))->value });
store.AddOrUpdate(txn_keys_[idx], *(Value*)(input_ptr + (idx & 0x7)), (k, v) => new Value { value = v.value + (input_ptr + (idx & 0x7))->value });
++writes_done;
break;
}
Expand Down Expand Up @@ -434,9 +430,9 @@ private void LoadDataFromFile(string filePath)
{
stream.Position = offset;
int size = stream.Read(chunk, 0, kFileChunkSize);
for (int idx = 0; idx < size; idx += Key.kSizeInBytes)
for (int idx = 0; idx < size; idx += 8)
{
init_keys_[count] = *((Key*)(chunk_ptr + idx));
init_keys_[count].value = *(long*)(chunk_ptr + idx);
++count;
}
if (size == kFileChunkSize)
Expand Down Expand Up @@ -466,8 +462,6 @@ private void LoadDataFromFile(string filePath)
Console.WriteLine("loading txns from " + txn_filename + " into memory...");

txn_keys_ = new Key[kTxnCount];
GCHandle handle2 = GCHandle.Alloc(txn_keys_, GCHandleType.Pinned);
txn_keys_ptr = (Key*)handle2.AddrOfPinnedObject();

count = 0;
long offset = 0;
Expand All @@ -476,7 +470,7 @@ private void LoadDataFromFile(string filePath)
{
stream.Position = offset;
int size = stream.Read(chunk, 0, kFileChunkSize);
for (int idx = 0; idx < size; idx += Key.kSizeInBytes)
for (int idx = 0; idx < size; idx += 8)
{
txn_keys_[count] = *((Key*)(chunk_ptr + idx));
++count;
Expand Down Expand Up @@ -545,8 +539,6 @@ private void LoadSyntheticData()
RandomGenerator generator = new RandomGenerator();

txn_keys_ = new Key[kTxnCount];
GCHandle handle2 = GCHandle.Alloc(txn_keys_, GCHandleType.Pinned);
txn_keys_ptr = (Key*)handle2.AddrOfPinnedObject();

for (int idx = 0; idx < kTxnCount; idx++)
{
Expand Down
Loading

0 comments on commit 54f23a4

Please sign in to comment.