Skip to content

Is crc32 realy needed? #161

@kroleg

Description

@kroleg

Currently to check if session changed koa-session does these:

  1. calculates crc of JSON.stringify'ed session data when it reads session from cookie/external storage
    this.prevHash = util.hash(this.session.toJSON());

    this.prevHash = util.hash(this.session.toJSON());

    return crc(JSON.stringify(sess));
  2. 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.

Resolves #131 and #156 (no need in faster crc calculator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions