Skip to content

too slow? #1

@powerman

Description

@powerman

I wonder why Go's bcrypt is 1.5 times slower than Perl's one? Look (I don't use shell's time for perl to exclude perl's startup time, which is much larger than Go's):

$ time bcrypt-tool hash '0123456789' 10
$2a$10$God/j.dxKvryLSZfCAziMuMeZBfV28Xu24G6liCxlQbCM3PNs17S.

real    0m0.073s
user    0m0.072s
sys 0m0.000s

$ perl -E '
    use Crypt::Eksblowfish::Bcrypt qw(en_base64 bcrypt);
    use Time::HiRes qw(time);
    $t=time;
    open my $rand, "<", "/dev/urandom" or die $!;
    16 == sysread $rand, my $salt, 16 or die $!;
    close $rand or die $!;
    say bcrypt("0123456789", q{$2a$10$}.en_base64($salt));
    say time-$t;
'
$2a$10$WgABAl2bimF7wAOpRebTL.FQdV4n8Ho0/cWA4pGas.PUKpQTbYAL6
0.0554509162902832

Well, to be 100% honest this Perl module is partially implemented in C, but, still, Go shouldn't be 1.5 times slower than C on such tasks, isn't it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions