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 DeclarativeEnvironmentRecord #458

Merged

Conversation

lahma
Copy link
Collaborator

@lahma lahma commented Jan 5, 2018

Now improving performance of my pet peeve UncacheableExpressionsBenchmark.

  • use MruPropertyCache2 and common parameter "arguments" as stored field, now dictionary won't be created for common arguments + single extra parameter
  • add missing implicit JsValue operators for uint and char, used sub-optimal double path
  • simplify often called JsValue Is* As* methods that have unnecessary nesting and logic

UncacheableExpressionsBenchmark execution time went down 22%, Map time went down 37%. 10% reduction in UncacheableExpressionsBenchmark memory usage.

Before (dev)

Method N Mean Error StdDev Gen 0 Allocated
Slice 100 1.199 ms 0.0249 ms 0.0233 ms 240.2344 986.72 KB
Concat 100 1.289 ms 0.0132 ms 0.0117 ms 259.7656 1070.31 KB
Unshift 100 38.819 ms 0.2905 ms 0.2718 ms 7000.0000 28789.06 KB
Push 100 25.200 ms 0.1081 ms 0.1011 ms 1625.0000 6766.41 KB
Index 100 26.802 ms 0.2575 ms 0.2409 ms 1531.2500 6333.59 KB
Map 100 7.339 ms 0.1466 ms 0.1299 ms 2109.3750 8692.19 KB
Apply 100 1.255 ms 0.0013 ms 0.0010 ms 267.5781 1098.44 KB
JsonStringifyParse 100 6.944 ms 0.0086 ms 0.0067 ms 1484.3750 6103.91 KB
Method N Mean Error StdDev Gen 0 Gen 1 Allocated
UncacheableExpressionsBenchmark 500 740.1 ms 78.08 ms 4.412 ms 129750.0000 36562.5000 556.2 MB

After (this branch)

Method N Mean Error StdDev Gen 0 Allocated
Slice 100 910.4 us 6.458 us 5.725 us 239.2578 982.81 KB
Concat 100 1,007.7 us 2.083 us 1.847 us 258.7891 1062.5 KB
Unshift 100 36,668.5 us 86.661 us 81.063 us 7000.0000 28785.16 KB
Push 100 24,286.9 us 30.631 us 28.653 us 1625.0000 6762.5 KB
Index 100 25,788.4 us 19.635 us 16.396 us 1531.2500 6333.59 KB
Map 100 4,607.4 us 10.529 us 9.333 us 1804.6875 7420.31 KB
Apply 100 1,023.9 us 3.040 us 2.843 us 267.5781 1098.44 KB
JsonStringifyParse 100 6,671.7 us 11.872 us 11.105 us 1484.3750 6100 KB
Method N Mean Error StdDev Gen 0 Gen 1 Allocated
UncacheableExpressionsBenchmark 500 578.6 ms 29.91 ms 1.690 ms 114937.5000 32791.6667 494.71 MB

* use MruPropertyCache2 and arguments as stored field
* add missing implicit JsValue operators for uint and char
* simplify often called JsValue Is* As*
@lahma lahma force-pushed the perf/optimize-declarative-env-record branch from b6e6efb to 2ecc556 Compare January 5, 2018 11:19
@sebastienros sebastienros merged commit 761a0a4 into sebastienros:dev Jan 5, 2018
@lahma lahma deleted the perf/optimize-declarative-env-record branch January 6, 2018 07:06
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.

None yet

2 participants