4 ms·
Why save the start and end? Why not just save the barrier between each line?
by BubRoss 6y ago
Why 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