Switch to faster version of staticMap#8535
Conversation
|
Thanks for your pull request and interest in making D better, @nordlow! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#8535" |
ff40348 to
7298da2
Compare
|
I wonder if we should delete the other versions of |
Yes, I think so. Ok with you, @andralex? |
Yes, there's no good reason to keep them around. |
|
Fantastic work, @BorisCarvajal and thanks @nordlow for following up! So satisfying to see the simplest, natural implementation also be fastest! |
|
@nordlow Please delete the other versions and let's get this in! |
|
Btw, regarding https://github.com/nordlow/phobos-next/blob/master/snippets/benchmark_staticMap.d regarding 0.08s 90 Mb I wonder why the second implementation is a slow as the third. Is there a reason why dmd cannot optimize it as good as the first @BorisCarvajal? |
|
Btw, the staticMap reversed at https://github.com/nordlow/phobos-next/blob/master/snippets/benchmark_staticMap_reversed.d gives the same speedup for the first case. Nice. |
7298da2 to
76c4a43
Compare
Ready for merge! |
Well, there are no optimizations at all, dmd just unrolls I suppose the difference is because: |
Now that
When compiling https://github.com/nordlow/phobos-next/blob/master/snippets/benchmark_staticMap.d,
the first implementation is the fastest and least memory consuming.
Implementations:
FYI, @andralex @atilaneves.