Is crc32 realy needed?
kroleg opened this issue · comments
Vitaliy Zaytsev commented
Currently to check if session changed koa-session
does these:
- calculates crc of JSON.stringify'ed session data when it reads session from cookie/external storage
Line 150 in 1600aab
Line 98 in 1600aab
Line 35 in 1600aab
- it calculates crc of session before commiting it and then compares new sum with old one.
So if instead of crc as a hash we will use result of JSON.stringify (i.e. const hash = (sess) => JSON.stringify(sess)
) we can shave of some time from request/response processing. Not much, but it will be -1 dependency. Not sure if memory consumption will increase, i think it depends on garbage collection.
oalieno commented
I'm also wondering why do we need crc32.
crc32 is used for error detection.
Simply compare the string will work.