integrate mode for consistent timing

use with
make t=perftest f='-O3 -DPERF_TEST' c
This commit is contained in:
dzaima 2021-07-30 02:19:15 +03:00
parent b18157d86b
commit 36afe7f533
2 changed files with 18 additions and 7 deletions

View File

@ -55,6 +55,9 @@ int main(int argc, char* argv[]) {
#endif #endif
bool startREPL = argc==1; bool startREPL = argc==1;
bool silentREPL = false; bool silentREPL = false;
#ifdef PERF_TEST
silentREPL = true;
#endif
if (!startREPL) { if (!startREPL) {
i32 i = 1; i32 i = 1;
while (i!=argc) { while (i!=argc) {
@ -171,13 +174,17 @@ int main(int argc, char* argv[]) {
#endif #endif
ptr_dec(block); ptr_dec(block);
#if FORMATTER #ifndef PERF_TEST
B resFmt = bqn_fmt(res); #if FORMATTER
printRaw(resFmt); dec(resFmt); B resFmt = bqn_fmt(res);
putchar('\n'); printRaw(resFmt); dec(resFmt);
putchar('\n');
#else
print(res); putchar('\n'); fflush(stdout);
dec(res);
#endif
#else #else
print(res); putchar('\n'); fflush(stdout); dec(res);
dec(res);
#endif #endif
#ifdef HEAP_VERIFY #ifdef HEAP_VERIFY

View File

@ -7,6 +7,10 @@ void hash_init() {
u64 bad1=0xa0761d6478bd642full; // values wyhash64 is afraid of u64 bad1=0xa0761d6478bd642full; // values wyhash64 is afraid of
u64 bad2=0xe7037ed1a0b428dbull; u64 bad2=0xe7037ed1a0b428dbull;
again: again:
make_secret(nsTime(), wy_secret); #ifdef PERF_TEST
make_secret(0, wy_secret);
#else
make_secret(nsTime(), wy_secret);
#endif
for (u64 i = 0; i < 4; i++) if(wy_secret[i]==bad1 || wy_secret[i]==bad2) goto again; for (u64 i = 0; i < 4; i++) if(wy_secret[i]==bad1 || wy_secret[i]==bad2) goto again;
} }