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
Do not use eval for known RefType instances #332
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This avoids to call `eval` for known `RefType` instances in `RefineMacro.impl`. This is similar to #330 but more general since it is an optimization for all macros in the library and not only for `autoRefine{V,T}`. The performance improvements are similar to that of #330: ``` [info] Result "eu.timepit.refined.benchmark.RefineMacroBenchmark.autoRefineV_PosInt": [info] 0.408 ±(99.9%) 0.003 s/op [Average] [info] (min, avg, max) = (0.387, 0.408, 0.442), stdev = 0.012 [info] CI (99.9%): [0.405, 0.411] (assumes normal distribution) [info] # Run complete. Total time: 00:09:11 [info] Benchmark Mode Cnt Score Error Units [info] RefineMacroBenchmark.autoRefineV_PosInt avgt 200 0.408 ± 0.003 s/op ```
Another advantage over #330 is that this does not change any public API. |
Codecov Report
@@ Coverage Diff @@
## master #332 +/- ##
==========================================
- Coverage 99.01% 96.23% -2.79%
==========================================
Files 38 38
Lines 408 425 +17
Branches 4 6 +2
==========================================
+ Hits 404 409 +5
- Misses 4 16 +12
Continue to review full report at Codecov.
|
fthomas
added a commit
that referenced
this pull request
Sep 28, 2017
This is the same as #332 but for `InferMacro`.
fthomas
added a commit
that referenced
this pull request
Sep 29, 2017
This avoids to call `eval` for a few `Validate` instances in `RefinedMacro.impl`. This is similar in spirit to #332. For the `autoRefineV_PosInt` benchmark we get a decrease in compilation time of ~56% (or ~67% prior to #332): ``` [info] Result "eu.timepit.refined.benchmark.RefineMacroBenchmark.autoRefineV_PosInt": [info] 0.181 ±(99.9%) 0.001 s/op [Average] [info] (min, avg, max) = (0.173, 0.181, 0.234), stdev = 0.006 [info] CI (99.9%): [0.180, 0.182] (assumes normal distribution) [info] # Run complete. Total time: 00:08:03 [info] Benchmark Mode Cnt Score Error Units [info] RefineMacroBenchmark.autoRefineV_PosInt avgt 200 0.181 ± 0.001 s/op ```
fthomas
added a commit
that referenced
this pull request
Sep 29, 2017
This avoids to call `eval` for a few `Validate` instances in `RefinedMacro.impl`. This is similar in spirit to #332. For the `autoRefineV_PosInt` benchmark we get a decrease in compilation time of ~56% (or ~67% prior to #332): ``` [info] Result "eu.timepit.refined.benchmark.RefineMacroBenchmark.autoRefineV_PosInt": [info] 0.181 ±(99.9%) 0.001 s/op [Average] [info] (min, avg, max) = (0.173, 0.181, 0.234), stdev = 0.006 [info] CI (99.9%): [0.180, 0.182] (assumes normal distribution) [info] # Run complete. Total time: 00:08:03 [info] Benchmark Mode Cnt Score Error Units [info] RefineMacroBenchmark.autoRefineV_PosInt avgt 200 0.181 ± 0.001 s/op ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This avoids to call
eval
for knownRefType
instances inRefineMacro.impl
. This is similar to #330 but more generalsince it is an optimization for all macros in the library and
not only for
autoRefine{V,T}
.The performance improvements are similar to that of #330: