diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2022-05-07 00:55:21 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-05-26 11:43:53 +0200 |
commit | e8f557df338df828481c940d44dd94fa9a9e2ee5 (patch) | |
tree | bf35208526e8525f31dec1b4a25e1c636532e62e /ovsdb | |
parent | 7b3a4c2e866e80d1da4e9fadc36872a9a4c7ca53 (diff) | |
download | openvswitch-e8f557df338df828481c940d44dd94fa9a9e2ee5.tar.gz |
sha1: Use implementation from openssl if available.
Implementation of SHA1 in OpenSSL library is much faster and optimized
for all available CPU architectures and instruction sets. OVS should
use it instead of internal implementation if possible.
Depending on compiler options OpenSSL's version finishes our sha1
unit tests from 3 to 12 times faster. Performance of OpenSSL's
version is constant, but OVS's implementation highly depends on
compiler. Interestingly, default build with '-g -O2' works faster
than optimized '-march=native -Ofast'.
Tests with ovsdb-server on big databases shows ~5-10% improvement of
the time needed for database compaction (sha1 is only a part of this
operation), depending on compiler options.
We still need internal implementation, because OpenSSL can be not
available on some platforms. Tests enhanced to check both versions
of API.
Reviewed-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ovsdb')
-rw-r--r-- | ovsdb/log.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ovsdb/log.c b/ovsdb/log.c index 4a28fa3db..e42f00246 100644 --- a/ovsdb/log.c +++ b/ovsdb/log.c @@ -400,6 +400,7 @@ parse_body(struct ovsdb_log *file, off_t offset, unsigned long int length, chunk = MIN(length, sizeof input); if (fread(input, 1, chunk, file->stream) != chunk) { + sha1_final(&ctx, sha1); json_parser_abort(parser); return ovsdb_io_error(ferror(file->stream) ? errno : EOF, "%s: error reading %lu bytes " |