From eac297d4d95b101d39dc69d9521efaf84b3e2f2a Mon Sep 17 00:00:00 2001 From: dzaima Date: Mon, 10 Jul 2023 16:31:49 +0300 Subject: [PATCH] =?UTF-8?q?actually=20add=20test/cases/perf.bqn=20(incl.?= =?UTF-8?q?=20a=20test=20of=20long=E2=8D=8Bshort)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- test/cases/perf.bqn | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 test/cases/perf.bqn diff --git a/.gitignore b/.gitignore index 83a768bc..75228046 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,7 @@ cbqn-jit.bqn # other /local/ -perf.* +perf.data* # clangd compile_commands.json diff --git a/test/cases/perf.bqn b/test/cases/perf.bqn new file mode 100644 index 00000000..52d692e5 --- /dev/null +++ b/test/cases/perf.bqn @@ -0,0 +1,41 @@ +%DEF var V←•internal.Variation ⋄ LV←•internal.ListVariations +%DEF tvar2 %USE var ⋄ _tvar2_ ← {F _𝕣_ 𝕘 x: {F 𝕩 V x}¨ 𝕘 LV 𝕩; w F _𝕣_ 𝕘 x: (𝕘 LV 𝕨) {(𝕨 V w) F 𝕩 V x}⌜ 𝕘 LV 𝕩} +%DEF fastone ( + _fastone ← { F _𝕣 𝕩: + t ← 0 + n ← 𝕩 + @∘F¨ ↕n + { 𝕊: + c ← F•_timed @ + "wasn't fast enough" ! (n<10) ∨ t<5 + t+↩ c + n+↩ 1 + c≥10000e¯9 + }•_while_⊢ 1 + n + } +) + +# in-place ⌾(n⊸⊑) +( + %USE fastone + { 𝕊 to‿ti: + a←b← to•internal.Variation 10⥊ < ti•internal.Variation ↕1e6 + n ← {𝕊: a 10⊸+⌾(4⊸⊑)⌾(1⊸⊑) ↩} _fastone 10 + ! (4+10×n) ≡ 4⊑1⊑a + }¨ ⟨"Ah"‿"Ai32", "Af"‿"Ai32", "Sh"‿"Ai32", "Sf"‿"Ai32", "Ah"‿"Ah"⟩ +) + +# in-place ⌾⊑ +%USE fastone ⋄ a←5+↕1e6 ⋄ n←{𝕊: a 1⊸+⌾⊑↩}_fastone 4 ⋄ ! (10↑a) ≡ (5+n)∾6+↕9 + +# in-place ⌾(l⊸⊏) +%USE fastone ⋄ a←5+↕1e6 ⋄ n←{𝕊: a 1⊸+⌾(1‿3‿3‿¯1⊸⊏)↩}_fastone 4 ⋄ ! (5‿6‿7‿8‿9‿1000000‿1000001‿1000002‿1000003‿1000004+0‿n‿0‿n‿0‿0‿0‿0‿0‿n) ≡ (5↑a)∾¯5↑a #%NDEBUG + +# in-place ∾⟜atom & ∾⟜list +%USE fastone ⋄ %USE tvar2 ⋄ {𝕊v: j←<⍟(×≡) v ⋄ {a←𝕩 ⋄ n←{𝕊: a∾↩j}_fastone 4 ⋄ !( n +≠𝕩)≡≠a ⋄ !a≡v¨a}_tvar2_"f" 1e6 ⥊<𝕩}¨ ⟨1, 1‿2, 'a'⟩ +%USE fastone ⋄ %USE tvar2 ⋄ {𝕊v: j←10⥊