Project

General

Profile

Actions

Bug #5784

open

libmd could use some performance love

Added by Eric Sproul about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2015-04-02
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

I got curious whether libmd/KCF would be faster at SHA2 hashing than OpenSSL, which we currently use in our application. It turns out that OpenSSL is significantly faster, especially in its latest version (1.0.2). This is perhaps not surprising when you consider that libmd hasn't changed since before illumos was born.

I constructed a trivial toy program to test (attached). I built two 64-bit binaries, one using libcrypto, the other libmd. It sha256-hashes a fixed string 10 million times in a loop.

I tested on OmniOS r151006 (OpenSSL 1.0.1m) and OmniOS "bloody" (OpenSSL 1.0.2a) from late March 2015, both on equivalent hardware (Xeon E5-1650v1), and systems otherwise idle. On r151006/1.0.1, OpenSSL was 11% faster than libmd. On bloody/1.0.2, it was 37% faster.

r151006/1.0.1

$ time ./hossl 

real    0m3.358s
user    0m3.355s
sys     0m0.003s

$ time ./hlmd 

real    0m3.804s
user    0m3.801s
sys     0m0.002s

bloody/1.0.2

$ time ./hossl 

real   0m2.494s
user   0m2.492s
sys    0m0.001s

$ time ./hlmd 

real   0m4.008s
user   0m4.005s
sys    0m0.003s


Files

hashtest.c (1022 Bytes) hashtest.c Eric Sproul, 2015-04-02 04:17 PM

No data to display

Actions

Also available in: Atom PDF