interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / core / cortex / tests / json / t_perf.om

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