Conversation
We probably have a bit of overhead due to unsafe casts. So it's more fair to have a reasonably sized array. The micro-benchmarking aspect is taken care of by our benchmarking framework, so the precision should still be as good. And it allows for slower tests.
I simply introduced a type class to abstract over the differences. I almost didn't do it because I was afraid that the extra `Ur` and `(,)` would pollute the result and bias the result in our favours. Maybe it does. The reads are a bit less different in this style. I guess it was to be expected because reads are so fast. But the benchmark still says that our implementation is slow. So I say: good enough.
25f62bb to
6c2e181
Compare
Member
Author
|
Should be good now. |
tbagrel1
approved these changes
May 4, 2023
Member
tbagrel1
left a comment
There was a problem hiding this comment.
I'm not sure I can convince myself that this code benchmarks each collection type without introducing extra noise that would impact performance.
That being said, at a syntactic/organisational level, the code is quite readable.
Using a single version of the code has created less tight benchmarks. This lets more specialisation happen. Though I can't say it's perfect either.
6c2e181 to
09a25b2
Compare
Member
Author
It does introduce noise. Now the question of whether it models actual real-life performance better or worse is much harder. I don't really know. I've added a commit that helps with inlining and specialisation to remove some of that noise. |
This file contains hidden or 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
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.
SeqtypeStill a draft because I need to format all this, and maybe I need to revisit a commit message: it would seem that the overhead that my refactoring introduced essentially compensates the difference between Vector and our linear arrays. Which proves that the extra
Urand(,)are probably where the issue is coming from (probably mostlyUrsince, as we can see in #328 , the(,)are unboxed. So having the ability to unboxUrwill really be critical for the extra bit of performance).That being said, there is something to be said for comparing the same scenarios. There is also something to be said for comparing idiomatic scenarios. In neither case is the comparison completely accurate anyway.
Here are my figures after this PR (note how good we are with writes, the figures are not too shabby honestly):