4 ms·
I have not programmed in Nim and I am a Pythonista. Having said that, I had to parse the whole wikipedia dump xml file once and extract just the text. The pyth
by sharmi 8y ago
I have not programmed in Nim and I am a Pythonista.
Having said that, I had to parse the whole wikipedia dump xml file once and extract just the text. The python code for the same was so slow and would have taken days to go through the whole xml file.
In my quest to find something faster, I came across a nim program that would take the xml in and dump a plain text file (or markdown?) file. It did the work within 2 hours.
So I don't believe it was slower than python.
Nim certainly has it's place and it is more comparable to go in speed.
- nudpiedo 8y agoIt was very straightforward code looping, counting and storing strings in memory and writing to a file. Looking in perspective my guess is that the optimized C runtime of python (IO and optimized string references) competed against Nim's bare strings. If you are a pythonista I have a question for you, especially since I could still give Nim a try, how much effort would be for you to add 2 or 3 generators and asyncs in the python code and put in place a better architecture without any macros? how easy is the same thing in Nim without any library our of the standard library? This speed of prototyping and bringing a better architecture to the solution sooner matters a lot more to me than raw speed (that comparison against python in speed was the last drop). I believe you when you say that Nim won, after all they promose that some parsers such as csv parser could fit in the L2 cache and so on... hopefully the language and quality of libraries has improved. P.S. how big was the whole wikipedia as XML? all languages?
- kungtotte 8y agoPython is intentionally a kitchen-sink type language that provides everything in its standard library, whereas Nim is intentionally the opposite. More and more things are moved out of its standard library to the package repository (Nimble). Thus, asking someone to write a stdlib-only solution in Nim is a bit of a trick question...