Commit e7b6afb
committed
Add OpenSSL backend for checksum computation.
After this change, every component that relies on checksuming would improve in
performance by a lot in thanks to OpenSSL optimised hash algorithms. My
benchmarks showed the following improvements:
- The benchmarking test was showing 0.16 GB/s raw speed with APR backend and
1.38 seconds GB/s with OpenSSL. All of those are SHA1. This is 8.62 times jump!
- Status of a working copy with a single file (with size of 370 MB) simply
touched was taking 1.94 seconds of real time to execute with APR backend and
0.30 seconds with OpenSSL (6.46 times improvement).
- The same test with a file of around 3 GB had a jump from 15.73 seconds to
2.23 seconds (7.05 times improvement).
- Checkout of the whole repository with those two files over file:// protocol
took 40 seconds with APR and 20 seconds with OpenSSL (2 times improvement).
Currenly, only CMake build system implements support for this feature. As far
as I checked, it should not at least break other build systems, but I didn't
implement support for them either.
This implementation relies on deprecated API of OpenSSL which (I think) is
objectively better than the approach they currenly consider recommended (which
is to use EVP interface).
1) it's just simpler
2) doesn't perform vtable calls
3) and OpenSSL uses it anyway in EVP
(personally, i don't get the reason why it was deprecated in the first place)
This is a completelly optional feature which is disabled by default. If one
doesn't want to use it, we wont force you to. There are many disadvantages of
loading such heavy libraries when we don't need all the stuff it gives us. This
optimisation comes with its own cost. But, our client already loads OpenSSL
indirectly through libserf so this is not an issue in some cases. Let's just
try it. Why not?
* CMakeLists.txt
(options): Add SVN_CHECKSUM_USE_OPENSSL.
(SVN_CHECKSUM_USE_OPENSSL): Check for option to decide whether to look for
the OpenSSL library and setup definitions or not.
(configsummary): Log value of SVN_CHECKSUM_USE_OPENSSL.
* build.conf
(libsvn_subr): Add dependency on openssl.
* subversion/libsvn_subr/checksum_apr.c
(): Put the whole file into an ifndef condition depending on
SVN_CHECKSUM_USE_OPENSSL.
* subversion/libsvn_subr/checksum_openssl.c
(svn_checksum__md5,
svn_checksum__md5_ctx_t,
svn_checksum__md5_ctx_create,
svn_checksum__md5_ctx_reset,
svn_checksum__md5_ctx_update,
svn_checksum__md5_ctx_final,
svn_checksum__sha1,
svn_checksum__sha1_ctx_t,
svn_checksum__sha1_ctx_create,
svn_checksum__sha1_ctx_reset,
svn_checksum__sha1_ctx_update,
svn_checksum__sha1_ctx_final): Implement through OpenSSL (under an ifdef).
git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1930949 13f79535-47bb-0310-9956-ffa450edef681 parent f73ee44 commit e7b6afb
File tree
4 files changed
+176
-1
lines changed- subversion/libsvn_subr
4 files changed
+176
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
386 | 398 | | |
387 | 399 | | |
388 | 400 | | |
| |||
952 | 964 | | |
953 | 965 | | |
954 | 966 | | |
| 967 | + | |
955 | 968 | | |
956 | 969 | | |
957 | 970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| 134 | + | |
| 135 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
0 commit comments