3 ms·
printf and scanf match nicely with their format specifiers, so the serialization and deserialization can be maintained nicely in lockstep. to avoid the quadrat
by froh 6y ago
printf and scanf match nicely with their format specifiers, so the serialization and deserialization can be maintained nicely in lockstep.
to avoid the quadratic overheating sttlen you can simply use fmemopen(3), which makes the temporary sscanf FILE object explicit and persistent for the whole parse, and needs just one strlen call.
https://news.ycombinator.com/item?id=26343149 https://news.ycombinator.com/item?id=26343149