summaryrefslogtreecommitdiff
path: root/ocaml/test/test_brass_cue.ml
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 23:18:59 +0700
committerpolwex <polwex@sortug.com>2025-10-06 23:18:59 +0700
commit5de3f7a3ad7b0cf63b4a6cbddfc1e26359dea161 (patch)
treeb55b2258123149bed40bd89bbaa58e7da54f3a26 /ocaml/test/test_brass_cue.ml
parentfdab65f6dac4ba85ed4749f61970660d1132d453 (diff)
cleaned up tests
Diffstat (limited to 'ocaml/test/test_brass_cue.ml')
-rw-r--r--ocaml/test/test_brass_cue.ml89
1 files changed, 0 insertions, 89 deletions
diff --git a/ocaml/test/test_brass_cue.ml b/ocaml/test/test_brass_cue.ml
deleted file mode 100644
index 0a431cf..0000000
--- a/ocaml/test/test_brass_cue.ml
+++ /dev/null
@@ -1,89 +0,0 @@
-(* Test cuing the massive brass/prod pill *)
-
-open Nock_lib
-
-let test_brass env =
- Printf.printf "šŸš€ Testing Brass/Prod Pill Cue\n\n";
-
- Eio.Switch.run @@ fun _sw ->
- let fs = Eio.Stdenv.fs env in
-
- (* Load brass pill *)
- Printf.printf "Loading prod.pill (169 MB - this may take a moment)...\n%!";
- let file_path = Eio.Path.(fs / "prod.pill") in
-
- let load_start = Unix.gettimeofday () in
- let pill_bytes = Eio.Path.load file_path |> Bytes.of_string in
- let load_time = Unix.gettimeofday () -. load_start in
-
- let size_mb = float_of_int (Bytes.length pill_bytes) /. 1024.0 /. 1024.0 in
- Printf.printf "āœ“ Loaded %.1f MB in %.2fs\n\n" size_mb load_time;
-
- (* Cue with progress *)
- Printf.printf "Starting cue (this is 20x bigger than solid pill!)...\n%!";
-
- let last_tick = ref (Unix.gettimeofday ()) in
- let start = Unix.gettimeofday () in
-
- let progress ~nouns ~bits ~depth ~max_depth =
- let now = Unix.gettimeofday () in
- if now -. !last_tick >= 1.0 then begin
- let mb = float_of_int bits /. 8.0 /. 1024.0 /. 1024.0 in
- let pct = (float_of_int bits /. 8.0) /. float_of_int (Bytes.length pill_bytes) *. 100.0 in
- let elapsed = now -. start in
- let throughput = mb /. elapsed in
- Printf.printf " %.1fs | %.1f MB (%.1f%%) | %dk nouns | depth %d/%d | %.2f MB/s\n%!"
- elapsed mb pct (nouns / 1000) depth max_depth throughput;
- last_tick := now
- end
- in
-
- let pill = Serial.cue ~progress ~progress_interval:100_000 pill_bytes in
- let elapsed = Unix.gettimeofday () -. start in
-
- Printf.printf "\nāœ“ Cued in %.1fs!\n\n" elapsed;
-
- let throughput = size_mb /. elapsed in
- Printf.printf "Performance:\n";
- Printf.printf " Size: %.1f MB\n" size_mb;
- Printf.printf " Time: %.1fs\n" elapsed;
- Printf.printf " Throughput: %.2f MB/s\n\n" throughput;
-
- (* Compare to solid pill *)
- let solid_time = 1.2 in
- let solid_size = 8.7 in
- let size_ratio = size_mb /. solid_size in
- let time_ratio = elapsed /. solid_time in
-
- Printf.printf "Comparison to solid pill:\n";
- Printf.printf " Size ratio: %.1fx bigger\n" size_ratio;
- Printf.printf " Time ratio: %.1fx slower\n" time_ratio;
- Printf.printf " Scaling: %.1f%% linear\n" ((size_ratio /. time_ratio) *. 100.0);
-
- if time_ratio <= size_ratio *. 1.2 then
- Printf.printf "\nšŸŽ‰ Excellent scaling! Performance is near-linear!\n"
- else
- Printf.printf "\nāš ļø Non-linear scaling detected\n";
-
- (* Check structure *)
- Printf.printf "\nExamining structure...\n";
- match pill with
- | Noun.Cell (tag, _events) ->
- begin match tag with
- | Noun.Atom a ->
- Printf.printf " Tag: %s (hex: 0x%s)\n" (Z.to_string a) (Z.format "x" a);
- if Z.equal a (Z.of_string "1819044208") then
- Printf.printf " āœ“ Valid 'llip' tag\n"
- | _ -> Printf.printf " Tag: cell\n"
- end
- | _ ->
- Printf.printf " āœ— Not a cell\n"
-
-let () =
- Printf.printf "\n";
- Printf.printf "═══════════════════════════════════════════════════════════\n";
- Printf.printf " Brass/Prod Pill Cue Test\n";
- Printf.printf "═══════════════════════════════════════════════════════════\n";
- Printf.printf "\n";
-
- Eio_main.run test_brass