Skip to content
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 PropertyDescriptor with flags #495

Merged
merged 3 commits into from
Apr 16, 2018

Conversation

lahma
Copy link
Collaborator

@lahma lahma commented Apr 15, 2018

We get more performance with no need to do interface dispatch for common property descriptor properties. Some memory penalty but the speed increase should be worth it - can check later on can we reduce memory usage without sacrificing speed.

  • optimize methods and make tweaks for better inlining
  • use flags enum for PropertyDescriptor
  • remove Get and Set backing fields from PropertyDescriptor, separate GetSetPropertyDescriptor
  • remove IPropertyDescriptor now that we have fast and memory efficient PropertyDescriptor

Esprima.Benchmark.DromaeoBenchmark

Diff Method FileName Mean Gen 0 Gen 1 Gen 2 Allocated
Old Run dromaeo-3d-cube 103.35 ms 1312.5000 250.0000 - 7107.59 KB
New 95.37 ms (-8%) 1375.0000 (+5%) 312.5000 (+25%) - 7349.61 KB (+3%)
Old Run dromaeo-core-eval 24.70 ms 62.5000 - - 298.95 KB
New 22.53 ms (-9%) 62.5000 (0%) - - 299.09 KB (0%)
Old Run dromaeo-object-array 259.58 ms 39500.0000 2000.0000 1000.0000 166027.24 KB
New 216.87 ms (-16%) 43250.0000 (+9%) 2000.0000 (0%) 1000.0000 (0%) 181394.68 KB (+9%)
Old Run dromaeo-object-regexp 1,142.73 ms 57750.0000 34750.0000 22125.0000 433170.74 KB
New 1,185.22 ms (+4%) 59437.5000 (+3%) 33000.0000 (-5%) 22312.5000 (+1%) 451764.26 KB (+4%)
Old Run dromaeo-object-string 1,359.54 ms 220812.5000 178437.5000 175812.5000 1392803.07 KB
New 1,312.64 ms (-3%) 223250.0000 (+1%) 181000.0000 (+1%) 177937.5000 (+1%) 1395016.54 KB (0%)
Old Run dromaeo-string-base64 234.61 ms 6187.5000 187.5000 - 26458.12 KB
New 221.46 ms (-6%) 6437.5000 (+4%) 375.0000 (+100%) - 27675.41 KB (+5%)

Jint.Benchmark.ArrayBenchmark

Diff Method N Mean Gen 0 Allocated
Old Slice 100 671.5 us 145.5078 598.44 KB
New 585.8 us (-13%) 161.1328 (+11%) 662.5 KB (+11%)
Old Concat 100 797.6 us 162.1094 666.41 KB
New 683.0 us (-14%) 177.7344 (+10%) 728.91 KB (+9%)
Old Unshift 100 30,480.2 us 3031.2500 12525.78 KB
New 24,312.1 us (-20%) 3625.0000 (+20%) 14931.25 KB (+19%)
Old Push 100 17,942.4 us 593.7500 2518.75 KB
New 15,271.4 us (-15%) 578.1250 (-3%) 2392.97 KB (-5%)
Old Index 100 16,595.0 us 343.7500 1515.63 KB
New 14,445.7 us (-13%) 390.6250 (+14%) 1642.97 KB (+8%)
Old Map 100 4,150.7 us 796.8750 3286.72 KB
New 4,070.1 us (-2%) 812.5000 (+2%) 3353.91 KB (+2%)
Old Apply 100 933.3 us 176.7578 727.34 KB
New 780.7 us (-16%) 192.3828 (+9%) 789.06 KB (+8%)
Old JsonStringifyParse 100 5,289.6 us 1242.1875 5111.72 KB
New 4,996.3 us (-6%) 1257.8125 (+1%) 5175 KB (+1%)

Jint.Benchmark.ArrayStressBenchmark

Diff Method N Mean Gen 0 Gen 1 Allocated
Old Jint 20 1.646 s 60000.0000 5000.0000 249.81 MB
New 813.2 ms (-51%) 60000.0000 (0%) 12437.5000 (+149%) 264.85 MB (+6%)

Jint.Benchmark.UncacheableExpressionsBenchmark

Diff Method N Mean Gen 0 Gen 1 Allocated
Old Benchmark 500 461.2 ms 52812.5000 62.5000 211.35 MB
New 428.8 ms (-7%) 54812.5000 (+4%) 5875.0000 (+9300%) 220.71 MB (+4%)

* optimize methods and make tweak for better inlining
* use flags enum for PropertyDescriptor
* remove Get and Set backing fields from PropertyDescriptor, separate GetSetPropertyDescriptor
@lahma lahma force-pushed the perf/optimize-array-instance branch from 99ecd09 to b3b282d Compare April 16, 2018 17:51
@sebastienros sebastienros merged commit 37df293 into sebastienros:dev Apr 16, 2018
@lahma lahma deleted the perf/optimize-array-instance branch April 20, 2018 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants