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/cortex/blob/main/tests/json/t_perf.om # cortex aien-dev/cortex Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cortex / tests / json / t_perf.om` 112 lines · 2381 bytes Raw Blame History 1 note tests/json/t_perf.om - throughput probe (host only). Prints "name total_ns bytes_or_ops" lines. 2 note (1) ru_contains, 6,000,000-byte haystack, needle absent (full scan incl. lowering), 5 calls: 3 note Greek-heavy (two final-sigma contexts per 90 bytes) and Latin text with one 2-byte char 4 note (2) js_parse of a generated JSON array of objects (~4 MB), (3) js_canon of that tree, 5 note (4) js_f64 (zmij) of 1,000,000 doubles. 6 text tpat "Hello World, Grosse GRÖSSE ΣΑΣ café TODO memory-entity 12345 the quick brown fox. " 7 text tnd "zzq needle absent" 8 text tpat2 "Memory entity: café owner Drake, TODO verify GPU receipt 12345; the quick brown fox jumps. " 9 text tob1 "{\"id\":\"`8b0c2a8e`-1f0a-4c55-9a7e-`2b1d7a6e9f01`\",\"name\":\"Entity n\\u00e9 \\\"quoted\\\"\",\"conf\":0.875,\"rev\":12,\"tags\":[\"a\",\"b\",true,null],\"meta\":{\"z\":1,\"a\":-2.5e-7}}" 10 global tln uchar 64 11 fn t_line nm view uchar * ns ulong v ulong to void 12 put jobl 0 0 13 js_raw nm 14 js_byte 32 15 js_u64 ns 16 js_byte 32 17 js_u64 v 18 js_byte 10 19 w = write 1 job 0 get jobl 0 20 end 21 text n1 "ru_contains_5x6MB_ns" 22 text n1b "ru_contains_5x6MB_latin_ns" 23 text n2 "js_parse_ns_bytes" 24 text n3 "js_canon_ns_bytes" 25 text n4 "js_f64_1M_ns" 26 fn main to int 27 num_init 28 note the needle is prepared first: ru_prep uses jrs as scratch 29 for k ulong len tnd 30 put jrq k get tnd k 31 end 32 put jrql 0 len tnd 33 ru_prep 34 n = ulong 0 35 for it ulong `1000000` 36 if ge n `6000000` 37 break 38 end 39 for k ulong len tpat 40 if lt n `6000000` 41 put jrs n get tpat k 42 n = add n 1 43 end 44 end 45 end 46 put jrsl 0 `6000000` 47 t0 = monons 48 for r ulong 5 49 if ru_contains 50 ret 2 51 end 52 end 53 t1 = monons 54 t_line n1 ulong sub t1 t0 `30000000` 55 n = 0 56 for it ulong `1000000` 57 if ge n `6000000` 58 break 59 end 60 for k ulong len tpat2 61 if lt n `6000000` 62 put jrs n get tpat2 k 63 n = add n 1 64 end 65 end 66 end 67 t0 = monons 68 for r ulong 5 69 if ru_contains 70 ret 4 71 end 72 end 73 t1 = monons 74 t_line n1b ulong sub t1 t0 `30000000` 75 p = ulong 0 76 put jin p 91 77 p = 1 78 for i ulong 30000 79 if ne i 0 80 put jin p 44 81 p = add p 1 82 end 83 for k ulong len tob1 84 put jin p get tob1 k 85 p = add p 1 86 end 87 end 88 put jin p 93 89 p = add p 1 90 put jinl 0 p 91 t0 = monons 92 if not js_parse 93 ret 3 94 end 95 t1 = monons 96 t_line n2 ulong sub t1 t0 p 97 put jobl 0 0 98 t0 = monons 99 js_canon get jroot 0 100 t1 = monons 101 t_line n3 ulong sub t1 t0 get jobl 0 102 v = ulong `4607182418800017408` 103 t0 = monons 104 for i ulong `1000000` 105 put jobl 0 0 106 js_f64 v 107 v = add v `1234567890123` 108 end 109 t1 = monons 110 t_line n4 ulong sub t1 t0 `1000000` 111 ret 0 112 end