-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Make ToDouble sealed interface #132053
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
base: main
Are you sure you want to change the base?
Make ToDouble sealed interface #132053
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
| * but it gets the job done for now. | ||
| */ | ||
| public interface ToDouble { | ||
| public sealed interface ToDouble permits SortableLongToDouble, SortableIntToFloat, SortableShortToHalfFloat, LongToScaledFloat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: I do not think we need permits when all implementations are in the same file, do we?
| /** | ||
| * Convert from the stored {@link long} into the {@link double} to load. | ||
| * Sadly, this will go megamorphic pretty quickly and slow us down, | ||
| * but it gets the job done for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change enough to prevent megamorphic call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd have expected that you'd need to make a copy of read(BlockFactory factory, Docs docs, int offset) for each one. but I could certainly be wrong here.
idegtiarenko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not mind the change, however I am interested to know if that actually improves the benchmark
|
@dnhatn Are you planning to merge this? I think this would be beneficial, especially in |
I ran a time-series benchmark and saw overhead when converting longs to doubles. This change removes the TODO and implements the sealed interface for ToDouble.