Thread of 4 posts
Something that I don't see talked about enough: the effect of file formats
Or how, just by changing the file format I do the same job in about 1.3% of the time of a naïve implementation, and about 10% of the time of a "clever" implementation.
So I have to load this kind of inventory data, which needs to be loaded into a program.
I receive this as an .xlsx, which, ideally I do not want to touch or care about, as it can be updated any time.
I use a standard library to read it blindly (aka: using the examples) and get a sucky performance of about 27s to run the tests, which is waaay off from what I need.
So, of course, I got to learn about how .xlsx has this concept of "Shared Strings", which is an ordered list in a workbook, and any cell can reference such a "Shared String" value, by using the index (as a string, but that's a different story).
So I get clever and pre-create a dictionary which will be much faster for lookups, and get the thing down to about 3.7s.
That's about 13% of the first iteration.
Better, but still unacceptable for this use-case.
So I say "eff it" and create a .tsv off each sheet from the original .xlsx, write a basic parser and run tests again: about 750ms, which is much better, but still not good enough.
Still, I decide it's decent and can improve upon that at a later time, so I remove the .xlsx handling code, including the related library (smaller binary: yay!)
And magically, the tests now run within 360ms.
