session
session copied to clipboard
Use `turbo-crc32` package to calculate crc32.
turbo-crc32
is about 2x times faster than crc
.
crc: 987.866ms
buffer-crc32: 1387.205ms
turbo-crc32: 447.711ms
Coverage remained the same at 100.0% when pulling f3ef1638efa93f09bc479c814e3d1bf8b06eaed8 on reklatsmasters:patch/crc32 into 89c048adc5a64b6c12c87047b766ac34be10af77 on koajs:master.
Coverage remained the same at 100.0% when pulling f3ef1638efa93f09bc479c814e3d1bf8b06eaed8 on reklatsmasters:patch/crc32 into 89c048adc5a64b6c12c87047b766ac34be10af77 on koajs:master.
@reklatsmasters i was thinking today if it's possible to remove crc completly and simply compare JSON.stringify
'ed representations of session before and after. What do you think about it?
@kroleg I did not completely understand how to do it.
@kroleg A stable JSON.stringify would be needed when comparing since the order of keys isn't garanteed. Something like https://github.com/substack/json-stable-stringify although there are faster options.
@millette i don't think so. All json-stable-stringify
does is keys sorting. We don't need it. If session object wasn't modified then JSON.stringify
s output will not change.