in reply to Session id generation with Perl once more

So here we are again. After examining several posts about session generation, including Dancer's, Catalyst's and PHP's, I decided to roll my own. As I understood, there are generally 3 requirements: ... But I may well be missing something. Am I?

Well, you're rolling your own, thats rule 1, don't roll your own, unless you know what you're doing ...

That you're not comparing to the existing session id generators, no benchmarks or randomness testing , no algorithm reference ...

it hints that you don't know what you're doing

but then I don't really know much to say one way or another ... except i've seen some hints ... Re^4: Debugging cgi-bin script

  • Comment on Re: Session id generation with Perl once more

Replies are listed 'Best First'.
Re^2: Session id generation with Perl once more
by Dallaylaen (Chaplain) on Oct 10, 2016 at 13:05 UTC

    thats rule 1, don't roll your own

    Which is why I'm posting it here.

    no benchmarks

    You've got me on this, here's a benchmark. My proposed function is available here. (The repo is outdated, will need to check out devel branch).

    #!/usr/bin/env perl use strict; use warnings; use Benchmark qw(cmpthese); use Dancer::Session::Abstract; use Apache::Session::Generate::MD5; use Catalyst::Plugin::Session; use MVC::Neaf::X::Session; $SIG{__DIE__} = \&Carp::confess; my $cat = Catalyst::Plugin::Session->new; cmpthese( -1, { dancer => \&Dancer::Session::Abstract::build_id, apache => \&Apache::Session::Generate::MD5::generate, catalyst => sub { $cat->generate_session_id }, neaf => \&MVC::Neaf::X::Session::get_session_id, });

    Results of its execution on a 0.8 GHz intel laptop:

    bash$ perl -Ilib bench.pl Rate dancer catalyst apache neaf dancer 4886/s -- -62% -92% -93% catalyst 12922/s 164% -- -79% -81% apache 61265/s 1154% 374% -- -12% neaf 69591/s 1324% 439% 14% --

    no randomness testing

    Agreed, will search for a reference for doing that.