session icon indicating copy to clipboard operation
session copied to clipboard

Use `turbo-crc32` package to calculate crc32.

Open reklatsmasters opened this issue 5 years ago • 6 comments

turbo-crc32 is about 2x times faster than crc.

crc:            987.866ms
buffer-crc32:   1387.205ms
turbo-crc32:    447.711ms

reklatsmasters avatar Dec 15 '18 23:12 reklatsmasters

Coverage Status

Coverage remained the same at 100.0% when pulling f3ef1638efa93f09bc479c814e3d1bf8b06eaed8 on reklatsmasters:patch/crc32 into 89c048adc5a64b6c12c87047b766ac34be10af77 on koajs:master.

coveralls avatar Dec 15 '18 23:12 coveralls

Coverage Status

Coverage remained the same at 100.0% when pulling f3ef1638efa93f09bc479c814e3d1bf8b06eaed8 on reklatsmasters:patch/crc32 into 89c048adc5a64b6c12c87047b766ac34be10af77 on koajs:master.

coveralls avatar Dec 15 '18 23:12 coveralls

@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 avatar Dec 16 '18 14:12 kroleg

@kroleg I did not completely understand how to do it.

reklatsmasters avatar Dec 17 '18 18:12 reklatsmasters

@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 avatar Jun 03 '19 23:06 millette

@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.stringifys output will not change.

kroleg avatar Jun 17 '19 17:06 kroleg