diff options
author | polwex <polwex@sortug.com> | 2025-10-06 10:30:19 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-10-06 10:30:19 +0700 |
commit | 4be1d7f999ffb3eb1c12c54e863b141af21b3fbf (patch) | |
tree | 6e33b141cd98985799e02a253dddcf201fec6b74 /ocaml/bench_solid_cue.c | |
parent | c3545b7ba9e8448226417fab6edaa2d039c9babe (diff) |
some progress but man
Diffstat (limited to 'ocaml/bench_solid_cue.c')
-rw-r--r-- | ocaml/bench_solid_cue.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ocaml/bench_solid_cue.c b/ocaml/bench_solid_cue.c new file mode 100644 index 0000000..0e887ab --- /dev/null +++ b/ocaml/bench_solid_cue.c @@ -0,0 +1,50 @@ +/* Benchmark C Vere cue on solid pill */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> +#include <sys/stat.h> + +/* Minimal standalone cue benchmark - reads file and times it */ + +double get_time() { + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec + tv.tv_usec / 1000000.0; +} + +int main() { + const char *filename = "solid.pill"; + FILE *f = fopen(filename, "rb"); + if (!f) { + printf("Error: cannot open %s\n", filename); + return 1; + } + + /* Get file size */ + struct stat st; + fstat(fileno(f), &st); + size_t file_size = st.st_size; + + /* Read file */ + unsigned char *data = malloc(file_size); + fread(data, 1, file_size, f); + fclose(f); + + printf("File: %s (%.1f MB)\n", filename, file_size / 1024.0 / 1024.0); + printf("Timing cue operation...\n\n"); + + /* We would call u3s_cue_xeno here if linked with libvere + * For now just report file read time */ + + printf("Note: This is a placeholder. To get real C Vere cue timing:\n"); + printf(" 1. Build vere runtime\n"); + printf(" 2. Add timing to vere/pkg/vere/boot_tests.c\n"); + printf(" 3. Load solid.pill instead of ivory\n\n"); + + printf("Based on C Vere source, cue should take ~0.1-1 second for 8.7MB\n"); + printf("Our OCaml implementation takes >300 seconds (300x slower!)\n"); + + free(data); + return 0; +} |