logoalt Hacker News

delta_p_delta_xtoday at 4:33 AM1 replyview on HN

> zero copy and zero allocations

This is a red herring, because when you actually read the strings out, you still need to iterate through the length for each string—zero copy, zero allocation, but linear complexity.

> query file size, allocate buffer once, read it into the buffer, drop some NULL's into strategic positions, maybe shuffle some bytes around for that rare escape case, and you have a whole bunch of C strings, ready to use, and with no length limits.

I write parsers in a very different way—I keep the file buffer around as read-only until the end of the pipeline, prepare string views into the buffer, and pipe those along to the next step.


Replies

dh2022today at 4:58 AM

I think the concern was conserving memory ( which was scarce back then) and not iterating through each substring.

show 2 replies