-
Notifications
You must be signed in to change notification settings - Fork 3
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
List should use eq Nil instead of isEmpty for end of list detection #52
Comments
also MurmurHash3
|
@mkeskells I wrote a micro benchmark to compare the performance of list eq Nil and list.isEmpty , PR here , and the benchmark results is just as follows:
|
@feyman2016 I agree - this is suprising - I would be very interested into finding out what the bytecode looks like. |
@rorygraves @mkeskells
If we use
or if we use
These bytecode of both are just like what I thought they would be, which makes benchmark results even more difficult to explain. |
Is it that the jit cannot determine that Nil is a constant Can you try with a java class
|
What you can't see from the bytecode is what the jit does with this and the information that it deduces. |
That's why I suggest comparing to idiomatic java code |
I tried to find some clue from the machine code of Eq Nil (bench = 100000)
.isEmpty (bench = 100000)
Is it because .isEmpty is override in both |
I would look at a little benchmark - 3 method that does
test for performance, and look at the code generated. We are looking for the fastest! |
I wonder why the |
@szeiger #19 relates - @retronym did some cases in scala#6523, but I don't think that can be applied to deeper hierarchies without more work. There is some discussion in that ticket The problem is that a parent ctor can refer to the |
could be
The text was updated successfully, but these errors were encountered: