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

Reduce compilation times #328

Open
fthomas opened this issue Sep 22, 2017 · 4 comments
Open

Reduce compilation times #328

fthomas opened this issue Sep 22, 2017 · 4 comments

Comments

@fthomas
Copy link
Owner

fthomas commented Sep 22, 2017

This tweet https://twitter.com/missingfaktor/status/909064863917510656 shows that increased compilation time with refined is a major issue. We should investigate ways to get better in this regard.

fthomas added a commit that referenced this issue Sep 25, 2017
This specializes the macro implementations for `autoRefineV` and
`autoRefineT`. Both methods were defined in terms of the generic
`RefineMacro.impl` which works for any `RefType[F]`. This generic
implementation has the drawback that it needs to `eval` the implicit
`RefType` parameter at compile-time. Since `autoRefine{V,T}` already
know which `RefType` instance they will use, it is unnecessary to `eval`
them in the macro.

Here are the benchmark results for master and this change:
```
master:

[info] Result "eu.timepit.refined.benchmark.RefineMacroBenchmark.autoRefineV_PosInt":
[info]   0.549 ±(99.9%) 0.004 s/op [Average]
[info]   (min, avg, max) = (0.520, 0.549, 0.593), stdev = 0.015
[info]   CI (99.9%): [0.546, 0.553] (assumes normal distribution)
[info] # Run complete. Total time: 00:17:45
[info] Benchmark                                Mode  Cnt  Score   Error Units
[info] RefineMacroBenchmark.autoRefineV_PosInt  avgt  200  0.549 ± 0.004 s/op

impl_Refined:

[info] Result "eu.timepit.refined.benchmark.RefineMacroBenchmark.autoRefineV_PosInt":
[info]   0.403 ±(99.9%) 0.004 s/op [Average]
[info]   (min, avg, max) = (0.377, 0.403, 0.471), stdev = 0.017
[info]   CI (99.9%): [0.399, 0.407] (assumes normal distribution)
[info] # Run complete. Total time: 00:09:07
[info] Benchmark                                Mode  Cnt  Score   Error Units
[info] RefineMacroBenchmark.autoRefineV_PosInt  avgt  200  0.403 ± 0.004 s/op
```

That is a decrease in compilation time of ~26%. This is first PR towards
reduced compilation times: #328
fthomas added a commit that referenced this issue Sep 25, 2017
This specializes the macro implementations for `autoRefineV` and
`autoRefineT`. Both methods were defined in terms of the generic
`RefineMacro.impl` which works for any `RefType[F]`. This generic
implementation has the drawback that it needs to `eval` the implicit
`RefType` parameter at compile-time. Since `autoRefine{V,T}` already
know which `RefType` instance they will use, it is unnecessary to `eval`
them in the macro.

Here are the benchmark results for master and this change:
```
master:

[info] Result "eu.timepit.refined.benchmark.RefineMacroBenchmark.autoRefineV_PosInt":
[info]   0.549 ±(99.9%) 0.004 s/op [Average]
[info]   (min, avg, max) = (0.520, 0.549, 0.593), stdev = 0.015
[info]   CI (99.9%): [0.546, 0.553] (assumes normal distribution)
[info] # Run complete. Total time: 00:17:45
[info] Benchmark                                Mode  Cnt  Score   Error Units
[info] RefineMacroBenchmark.autoRefineV_PosInt  avgt  200  0.549 ± 0.004 s/op

impl_Refined:

[info] Result "eu.timepit.refined.benchmark.RefineMacroBenchmark.autoRefineV_PosInt":
[info]   0.403 ±(99.9%) 0.004 s/op [Average]
[info]   (min, avg, max) = (0.377, 0.403, 0.471), stdev = 0.017
[info]   CI (99.9%): [0.399, 0.407] (assumes normal distribution)
[info] # Run complete. Total time: 00:09:07
[info] Benchmark                                Mode  Cnt  Score   Error Units
[info] RefineMacroBenchmark.autoRefineV_PosInt  avgt  200  0.403 ± 0.004 s/op
```

That is a decrease in compilation time of ~26%. This is first PR towards
reduced compilation times: #328
@fthomas
Copy link
Owner Author

fthomas commented Sep 28, 2017

The first step towards this goal has been merged: ~26% reduced compilation times with #332.

@fthomas
Copy link
Owner Author

fthomas commented Sep 29, 2017

Further steps in this direction: #333 and #334

@fthomas
Copy link
Owner Author

fthomas commented Oct 3, 2017

General performance improvements: #335, #336, #337, and #338

@fthomas
Copy link
Owner Author

fthomas commented Dec 24, 2017

Reduced compilation time when refining with full refined types: #388

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

No branches or pull requests

1 participant