New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize interop #519

Merged
merged 3 commits into from Jul 11, 2018

Conversation

Projects
None yet
2 participants
@lahma
Collaborator

lahma commented Jun 29, 2018

Did a small sweep around interop, mostly cleanup and easy wins. I used the test cases to create some benchmarks.

  • faster property to descriptor lookup, cache results on engine level
  • use readonly for DiyFp and in to prevent defensive copies

InteropBenchmark

Diff Method Mean Gen 0 Allocated
Old DelegatesCanBeSet 8.798 us 1296.8750 5.2 MB
New 7.477 us (-15%) 1289.0625 (-1%) 5.17 MB (-1%)
Old ExtraParametersAreIgnored 11.425 us 1765.6250 7.11 MB
New 10.614 us (-7%) 1765.6250 (0%) 7.08 MB (0%)
Old GetObjectProperties 8.235 us 1265.6250 5.1 MB
New 6.022 us (-27%) 1187.5000 (-6%) 4.77 MB (-6%)
Old InvokeObjectMethods 11.202 us 1593.7500 6.43 MB
New 6.814 us (-39%) 1351.5625 (-15%) 5.42 MB (-16%)
Old SetObjectProperties 10.811 us 1609.3750 6.47 MB
New 8.213 us (-24%) 1515.6250 (-6%) 6.1 MB (-6%)
Old GetIndexUsingStringKey 28.703 us 3437.5000 13.75 MB
New 17.351 us (-40%) 2531.2500 (-26%) 10.22 MB (-26%)
Old GenericMethods 31.716 us 3562.5000 14.42 MB
New 19.890 us (-37%) 2437.5000 (-32%) 9.75 MB (-32%)
Old MultiGenericTypes 49.098 us 5562.5000 22.42 MB
New 38.013 us (-23%) 4687.5000 (-16%) 18.89 MB (-16%)
Old IndexOnList 23.963 us 3156.2500 12.66 MB
New 11.816 us (-51%) 1718.7500 (-46%) 6.88 MB (-46%)
Old EcmaValuesAreAutomaticallyConvertedWhenSetInPoco 24.974 us 3156.2500 12.63 MB
New 15.659 us (-37%) 2375.0000 (-25%) 9.51 MB (-25%)
Old Trim 16.977 us 2500.0000 10.03 MB
New 14.651 us (-14%) 2390.6250 (-4%) 9.58 MB (-4%)
Old MathFloor 17.772 us 2343.7500 9.41 MB
New 10.361 us (-42%) 1703.1250 (-27%) 6.87 MB (-27%)
Old DelegateAsFunction 8.348 us 1265.6250 5.11 MB
New 7.592 us (-9%) 1265.6250 (0%) 5.08 MB (-1%)
Old ConvertArrayToArrayInstance 11.017 us 2078.1250 8.33 MB
New 10.746 us (-2%) 2078.1250 (0%) 8.33 MB (0%)
Old ConvertListsToArrayInstance 13.238 us 2296.8750 9.2 MB
New 12.395 us (-6%) 2296.8750 (0%) 9.2 MB (0%)
Old ConvertArrayInstanceToArray 3.166 us 1105.4688 4.43 MB
New 3.205 us (+1%) 1105.4688 (0%) 4.43 MB (0%)
Old LoopWithNativeEnumerator 9.047 us 1296.8750 5.23 MB
New 7.879 us (-13%) 1296.8750 (0%) 5.23 MB (0%)

lahma added some commits Jun 29, 2018

#451 optimize interop
* faster lookups, cache results
* use readonly for DiyFp and in to prevent defensive copies
#451 more tweaks
* optimize FindBestMatch
* remove obsolete code
* prefer foreach for arrays

@sebastienros sebastienros merged commit 8bbd390 into sebastienros:dev Jul 11, 2018

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@lahma lahma deleted the lahma:perf/interop branch Jul 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment