-
Notifications
You must be signed in to change notification settings - Fork 2k
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
merykitty's attempt #114
merykitty's attempt #114
Conversation
Oh, wow, this looks very promising. 7.379s on the eval env, fastest so far! Summoning the current top of the pack @royvanrijn, @ebarlas, @spullara, for feedback too! |
It turns out that just prefetching the file manually helps lower the time by 20% on my machine, now it takes around 2 seconds, for comparison the baseline takes around 106 seconds and just reading the whole file without doing anything takes around 0.75 seconds. Thanks. |
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.
Very nice! This comes in at 7.6, i.e. first place currently! I've added some questions in line to further my (and others) understanding. It looks alright to me, but getting some more intuition would be great. Thanks a lot!
} | ||
|
||
private static long iterate(PoorManMap aggrMap, MemorySegment data, long offset) { | ||
var line = ByteVector.fromMemorySegment(BYTE_SPECIES, data, offset, ByteOrder.nativeOrder()); |
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 suppose this would fail if station names are e.g. 100 double-byte characters, right? Not a problem per se, we agreed yesterday on enforcing a 100 bytes limit for station names (rather than 100 UTF-8 characters), I'm just curious.
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.
No if we cannot find the delimiter which means the key is longer than the segment we fall back to slow path which do so in a more straightforward way,
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.
Ah yes, got it. Thanks for adding all the comments!
return offset; | ||
} | ||
|
||
private static long iterate(PoorManMap aggrMap, MemorySegment data, long offset) { |
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.
Could you provide a description of how that iteration loop works? I roughly get it, but it's quite dense code and having a high-level description would be great.
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.
Done
long designMask = ~(signed & 0xFF); | ||
long digits = ((word & designMask) << shift) & 0x0F000F0F00L; | ||
|
||
// Now digits is in the form 0xUU00TTHH00 |
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.
What is TT, HH, etc? As for the main loop, could you provide an overview of how this thing works?
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.
UU stands for the value of the units digit, TT is the tens digit and HH is the hundreds digit.
After trying again without prefetching I am also able to reach 2s, which is weird. Thanks for your reviews, hope I have addressed those. |
00:07.620, current #1! Very nice, thanks for participating! |
How does this one fare our with Graal? |
My attempt at this challenge,
test.sh merykitty
passed.Please kindly review, thanks very much.