quasi-1BRC in Nim clarifying relevance of challenge #95
c-blake
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
The problem is solvable in like 1-2 seconds. It's silly to say "Almost all of our tools are 10-1000x too slow at text parsing, therefor we shouldn't care about parsing." Real computers spend a lot of time on parsing, formatting, and codecs. Real people spend a lot of time waiting for those computers to do those things. It's worth doing them right eventually. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This breaks most written (& probably unwritten) rules of this challenge, but otherwise replicates the central calculation so to emphasize in a very hands-on way what the rules make this challenge actually about - ASCII parsing, not numeric reductions in DB systems as was mentioned on Lobsters -- as well as to show maybe why you shouldn't care. The "real" answer is to avoid ASCII as much as possible, just loading a binary format/DB once. Then the speed of code like the actual 1BRC doesn't matter so much (well, it can be nice to have a fast transformation to binary, but that should be run only once {or zero times if you can originate in binary as I also show in
mkSplit.nim
below}). I try to make binary (almost) as simple as CSV over in nio.Here is a HOW2 I wrote up and the 3 Nim files (one of which depends upon my
cligen
which you can clone and put in yournim c --path
), oh and theru
used in the HOW2 is from bu, but you can replace that with some timing utility of your own preference:and then
brc.nim
:and
mkSplit.nim
:and finally the main event
doSplit.nim
:Beta Was this translation helpful? Give feedback.
All reactions