various optimization

This commit is contained in:
Adam Ierymenko 2020-02-26 17:00:03 -08:00
parent 1c7e1da4d1
commit c5bd21a23e
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
4 changed files with 80 additions and 43 deletions

View file

@ -61,6 +61,7 @@ else(WIN32)
$<$<CONFIG:Debug>:-g> $<$<CONFIG:Debug>:-g>
$<$<CONFIG:DEBUG>:-O0> $<$<CONFIG:DEBUG>:-O0>
$<$<CONFIG:RELEASE>:-Ofast> $<$<CONFIG:RELEASE>:-Ofast>
$<$<CONFIG:RELEASE>:-ffast-math>
$<$<CONFIG:RELEASE>:-fPIE> $<$<CONFIG:RELEASE>:-fPIE>
$<$<CONFIG:RELEASE>:-flto> $<$<CONFIG:RELEASE>:-flto>
$<$<CONFIG:RELWITHDEBINFO>:-Ofast> $<$<CONFIG:RELWITHDEBINFO>:-Ofast>
@ -80,6 +81,7 @@ else(WIN32)
$<$<CONFIG:Debug>:-g> $<$<CONFIG:Debug>:-g>
$<$<CONFIG:DEBUG>:-O0> $<$<CONFIG:DEBUG>:-O0>
$<$<CONFIG:RELEASE>:-O3> $<$<CONFIG:RELEASE>:-O3>
$<$<CONFIG:RELEASE>:-ffast-math>
$<$<CONFIG:RELEASE>:-fPIE> $<$<CONFIG:RELEASE>:-fPIE>
$<$<CONFIG:RELWITHDEBINFO>:-O3> $<$<CONFIG:RELWITHDEBINFO>:-O3>
$<$<CONFIG:RELWITHDEBINFO>:-fPIE> $<$<CONFIG:RELWITHDEBINFO>:-fPIE>

View file

@ -22,7 +22,7 @@
#include <cstring> #include <cstring>
#ifndef ZT_AES_NO_ACCEL #ifndef ZT_AES_NO_ACCEL
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64)) #ifdef ZT_ARCH_X64
#include <wmmintrin.h> #include <wmmintrin.h>
#include <emmintrin.h> #include <emmintrin.h>
#include <smmintrin.h> #include <smmintrin.h>

File diff suppressed because one or more lines are too long

View file

@ -1029,7 +1029,7 @@ extern "C" const char *ZTT_benchmarkCrypto()
for(long i=0;i<10;++i) for(long i=0;i<10;++i)
foo = (uint8_t)id.locallyValidate(); foo = (uint8_t)id.locallyValidate();
end = now(); end = now();
ZT_T_PRINTF("%.4f μs/validation" ZT_EOL_S,((double)(end - start) * 1000.0) / 10.0); ZT_T_PRINTF("%.4f ms/validation" ZT_EOL_S,(double)(end - start) / 10.0);
ZT_T_PRINTF("[crypto] Benchmarking V1 Identity generation... "); ZT_T_PRINTF("[crypto] Benchmarking V1 Identity generation... ");
start = now(); start = now();
for(long i=0;i<5;++i) { for(long i=0;i<5;++i) {
@ -1043,7 +1043,7 @@ extern "C" const char *ZTT_benchmarkCrypto()
for(long i=0;i<100;++i) for(long i=0;i<100;++i)
foo = (uint8_t)id.locallyValidate(); foo = (uint8_t)id.locallyValidate();
end = now(); end = now();
ZT_T_PRINTF("%.4f μs/validation" ZT_EOL_S,((double)(end - start) * 1000.0) / 100.0); ZT_T_PRINTF("%.4f ms/validation" ZT_EOL_S,(double)(end - start) / 100.0);
} }
} catch (std::exception &e) { } catch (std::exception &e) {
ZT_T_PRINTF(ZT_EOL_S "[crypto] Unexpected exception: %s" ZT_EOL_S,e.what()); ZT_T_PRINTF(ZT_EOL_S "[crypto] Unexpected exception: %s" ZT_EOL_S,e.what());