Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/om/sha256/parity/small.c # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / sha256 / parity / small.c` 32 lines ยท 1438 bytes Raw Blame History 1 /* Short-input timing, C vs Omega SHA-256, interleaved in one process: for each length, 11 rounds of 2 * (C batch, Omega batch), each batch 200,000 calls; prints median and min..max ns per call. */ 3 #include "sha256.h" 4 #include 5 #include 6 #include 7 void orc_sha256_hash(const uint8_t *, size_t, uint8_t *); 8 static double now(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return t.tv_sec + t.tv_nsec * 1e-9; } 9 static int cmp(const void *a, const void *b) { double x = *(const double *)a, y = *(const double *)b; return (x > y) - (x < y); } 10 int main(void) 11 { 12 static uint8_t b[4096]; 13 uint8_t h[32]; 14 const int N = 200000, R = 11; 15 size_t L[] = {0, 32, 55, 64, 100, 200, 1000}; 16 for (int j = 0; j < 7; j++) { 17 double c[11], o[11]; 18 for (int r = 0; r < R; r++) { 19 double t = now(); 20 for (int i = 0; i < N; i++) { orc_sha256_hash(b, L[j], h); b[0] ^= h[0]; } 21 c[r] = (now() - t) / N * 1e9; 22 t = now(); 23 for (int i = 0; i < N; i++) { sha256_hash(b, L[j], h); b[0] ^= h[0]; } 24 o[r] = (now() - t) / N * 1e9; 25 } 26 qsort(c, R, sizeof c[0], cmp); 27 qsort(o, R, sizeof o[0], cmp); 28 printf("MEASURED len %4zu: omega median %.0f ns (%.0f..%.0f) C median %.0f ns (%.0f..%.0f) omega/C %.3f\n", 29 L[j], o[5], o[0], o[10], c[5], c[0], c[10], o[5] / c[5]); 30 } 31 return 0; 32 }