3 ms·
>- Saving the start and end position of a string that represents a date with 16 bytes is silly. I am not saving the start and end positions of a string that re
by afiodorov 6y ago
>- Saving the start and end position of a string that represents a date with 16 bytes is silly.
I am not saving the start and end positions of a string that represents a data; I am saving start and end position of a line, since I need to split the loaded file into lines. This requires extra memory. I tried sorting without caching the end position of the line (and always reading from start till \n), but it was slower to sort this way.
- BubRoss 6y agoWhy save the start and end? Why not just save the barrier between each line?
- afiodorov 6y agoas I mentioned in the parent comment I tried saving just the start of each line, and then during sorting scan from the start until '\n' character, but this turned out to be much slower
- BubRoss 6y agoIf you save the break between each line, you wouldn't have to scan to the end of the line, you would just look at the next line break.
- afiodorov 6y agothis would work, but once I start sorting lines I'll need a copy of original line breaks array; so in the end I'd need 16 bytes per line anyway