aumcode / nfx

C# Server UNISTACK framework [MOVED]
https://github.com/agnicore/nfx
Other
391 stars 93 forks source link

NLSMap - get rid of Dictionary<> for speed #31

Closed cNoNim closed 7 years ago

cNoNim commented 7 years ago

Use linear search instead of Dictionary<>

itadapter commented 7 years ago

The linear search on simple array works faster than dict[] when item count < 6. I will think how to refactor , definitely need to get rid of dict<>

itadapter commented 7 years ago

BEFORE

20170120 SEXTOD Dictionary Optimization, 111000 Created 111,000 in 5,655 ms at 19,629 ops/sec Occupied bytes 805,306,368 Read 111,000 in 8,468 ms at 13,142 ops/sec

AFTER

20170120 SEXTOD Array, Optimization, 111000 Created 111,000 in 5,200 ms at 21,387 ops/sec Occupied bytes 805,306,368 Read 111,000 in 6,247 ms at 17,906 ops/sec

Write: + 8.9% Read: +36.2%

The test was done on real business like payload, not only NLSMap, so these results represent real complex objects. NLSMap-only would have shown more difference See: HeavyProductRow