Subscribed unsubscribe Subscribe Subscribe

Hateburo: kazeburo hatenablog

Operations Engineer / Site Reliability / 運用系小姑 / Perl Monger

Plack::Middleware::Session uses Cookie::Baker

Plack::Middleware::Session 0.21 uses Cookie::Baker for improve performance. Cookie::Baker is simple cookie generator/parser module.

https://metacpan.org/release/Plack-Middleware-Session

Previous version of Plack::Middleware::Session uses Plack::Response for only generating cookie strings. By using Cookie::Baker, cookie header setter becomes 600% faster.

benchmark: https://gist.github.com/kazeburo/6896740

Benchmark: running baker, original for at least 1 CPU seconds...
     baker:  1 wallclock secs ( 1.06 usr +  0.00 sys =  1.06 CPU) @ 95466.98/s (n=101195)
  original:  1 wallclock secs ( 1.14 usr +  0.00 sys =  1.14 CPU) @ 13472.81/s (n=15359)
            Rate original    baker
original 13473/s       --     -86%
baker    95467/s     609%       --