jshttp / cookie

HTTP server cookie parsing and serialization
MIT License
1.36k stars 159 forks source link

perf(parse): remove additional slice for quoted values #143

Closed kurtextrem closed 1 month ago

kurtextrem commented 2 years ago

see https://github.com/fastify/fastify-cookie/pull/194#issuecomment-1184444263

Before & after as diff: https://www.diffchecker.com/hO2It0SH on node v16 (unquote -> +300 000 op/s)

blakeembrey commented 1 month ago

Going to close this out, I managed to get an extra 10% perf boost across the board by instead iterating using a loop over whitespace (no more trim at all) in https://github.com/jshttp/cookie/pull/170, and it maintains backward compatibility with the quote characters.