3F / Conari

🧬 One-touch unmanaged memory, runtime dynamic use of the unmanaged native C/C++ in .NET world, related P/Invoke features, and …
MIT License
252 stars 28 forks source link

Speed #10

Closed 3F closed 5 years ago

3F commented 7 years ago

For planned v1.3 I implemented new caching of the binding in core provider

test via snet tool (part of regXwild)

x32 library:

Unicode: true
iterations(10000) x average(4)

.... regXwild via Conari (Lambda) - ESS version: ~61ms
.... regXwild via Conari (DLR)- ESS version: ~222ms
.... regXwild via Conari (Lambda) - EXT version: ~58ms
.... regXwild via Conari (DLR) - EXT version: ~218ms

....

x64 library:

.NET version via Conari engine

Unicode: true
iterations(10000) x average(4)

.... regXwild via Conari (Lambda) - ESS version: ~43ms
.... regXwild via Conari (DLR)- ESS version: ~245ms
.... regXwild via Conari (Lambda) - EXT version: ~37ms
.... regXwild via Conari (DLR) - EXT version: ~237ms

#####

The regex engine is much more slower (~30-90sec for 10000 iterations), please wait...

Compiled: true
iterations(10000) x average(4)

.... .NET Regex engine: ~37611ms
.... .NET Regex engine(only as ^match$ like a simple '=='): ~2ms

-------

Compiled: false
iterations(10000) x average(4)

.... .NET Regex engine: ~31034ms
.... .NET Regex engine(only as ^match$ like a simple '=='): < 1ms

Done.

looks good !

old result:

( <= v1.2) +icase [x32] +icase [x64]
regXwild via Conari (Lambda) - ESS ~1032ms ~1418ms
regXwild via Conari (DLR) - ESS ~1238ms ~1609ms
regXwild via Conari (Lambda) - EXT ~1117ms ~1457ms
regXwild via Conari (DLR) - EXT ~1246ms ~1601ms

but I'm not sure about that binding to specific values are correct for all cases. I added new unit-tests and this also looks good, so ...

Currently I implemented this via 0x29 opcode (Calli), and the all arguments should be pushed onto the stack before each calling. Thus the cached TDyn should be valid for custom values via std. stack

for(int i = 0; i < mParams.Length; ++i) {
    il.Emit(OpCodes.Ldarg, i);
}

Use IProvider.Cache if not, and report about this here.