actually add test/cases/perf.bqn (incl. a test of long⍋short)

This commit is contained in:
dzaima 2023-07-10 16:31:49 +03:00
parent 1cea42cad3
commit eac297d4d9
2 changed files with 42 additions and 1 deletions

2
.gitignore vendored
View File

@ -40,7 +40,7 @@ cbqn-jit.bqn
# other # other
/local/ /local/
perf.* perf.data*
# clangd # clangd
compile_commands.json compile_commands.json

41
test/cases/perf.bqn Normal file
View File

@ -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
c10000e¯9
}•_while_ 1
n
}
)
# in-place ⌾(n⊸⊑)
(
%USE fastone
{ 𝕊 toti:
ab to•internal.Variation 10 < ti•internal.Variation 1e6
n {𝕊: a 10+(4)(1) } _fastone 10
! (4+10×n) 41a
}¨ "Ah""Ai32", "Af""Ai32", "Sh""Ai32", "Sf""Ai32", "Ah""Ah"
)
# in-place ⌾⊑
%USE fastone a5+1e6 n{𝕊: a 1+}_fastone 4 ! (10a) (5+n)6+9
# in-place ⌾(l⊸⊏)
%USE fastone a5+1e6 n{𝕊: a 1+(133¯1)}_fastone 4 ! (5678910000001000001100000210000031000004+0n0n00000n) (5a)¯5a #%NDEBUG
# in-place ∾⟜atom & ∾⟜list
%USE fastone %USE tvar2 {𝕊v: j<(×) v {a𝕩 n{𝕊: aj}_fastone 4 !( n +𝕩)a !av¨a}_tvar2_"f" 1e6 <𝕩}¨ 1, 12, 'a'
%USE fastone %USE tvar2 {𝕊v: j10<v {a𝕩 n{𝕊: aj}_fastone 4 !((10×n)+𝕩)a !av¨a}_tvar2_"f" 1e6 <𝕩}¨ 1, 12, 'a'
%USE fastone %USE tvar2 {𝕊v: j10<v {a𝕩 n{𝕊: aj}_fastone 4 !(10˜ n+𝕩)a !av¨a}_tvar2_"f" 1e510<𝕩}¨ 1, 12, 'a'
# amortized fast ⍋ with long 𝕨 & tiny 𝕩
%USE fastone %USE tvar2 (1e6/10) {𝕨𝕩 _fastone 1} _tvar2_"f" 10