blob: 0e887aba31eaf369650f5d39e830f42e5f05dfb9 (
plain)
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
|
/* 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;
}
|