Skip to content

Instantly share code, notes, and snippets.

@timo
Created May 7, 2020 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/4ab10d462ae36e06bde5e7e139838db0 to your computer and use it in GitHub Desktop.
Save timo/4ab10d462ae36e06bde5e7e139838db0 to your computer and use it in GitHub Desktop.
cool new hyperop impl
env RAKUDO_OPTIMIZER_HYPER=1 ./rakudo-m --ll-exception -e '
my int @result;
my int @input1 = 450..^4_500;
my int @input2 = |[0..32] xx 10;
say +@result;
say "--";
for ^10_000 { @result = (@input1 Z[+<] @input2) >>*>> @input1 };
.say for @result;
say "--";
say +@result'
0
--
202500
406802
817216
1641672
3297856
6624800
13307904
26732672
53699584
107868672
216678400
435243008
874266624
1756110848
3527409664
7085260800
14231535616
28585361408
57415827456
115322912768
231630438400
465234296832
934423822336
1876774879232
3769437782016
7570718720000
15205257969664
30538425434112
61333206728704
123180198920192
247390116249600
496843964284928
997823982075904
233289
468512
940900
1889568
3794704
7620608
15303744
30732800
61716736
123936768
248882176
499785728
1003622400
2015363072
4046995456
8126595072
16318529536
32768000000
65798406144
132122673152
265299165184
532710162432
1069652377600
2147785637888
4312566595584
8659190939648
17386631593984
34910031052800
70094134706176
140737488355328
282575562080256
567356589867008
1139132701081600
266256
534578
1073296
2154888
4326400
8686112
17438976
35011712
70291456
141120000
283316224
568788992
1141899264
2292457472
4602265600
9239298048
18548260864
37236113408
74751934464
150064332800
301251690496
604753625088
1214016126976
2437066784768
4892236185600
9820744712192
19714168324096
39573962883072
79439715106816
159464082636800
320099617603584
642546434834432
1289795858857984
301401
605000
1214404
2437632
4892944
9821312
19713600
39569408
79423744
159418368
319980544
642252800
1289097216
2587394048
5193220096
10423369728
20920729600
41989701632
84276412416
169147891712
339488014336
681364684800
1367515070464
2744618319872
5508446552064
11055380037632
22187868160000
44530220924928
89369947930624
179359981764608
359962282819584
722413499187200
1449813455405056
338724
679778
1364224
2737800
5494336
11026208
22127616
44405888
89113600
178831872
358875136
720177152
1445216256
2900172800
5819858944
11678810112
23435935744
47028764672
94371840000
189373349888
380008136704
762543341568
1530149208064
3070440243200
6161197694976
12363096915968
24807731101696
49778805178368
99884833177600
200425185738752
402163557728256
806957782925312
1619185490722816
378225
758912
1522756
3055392
6130576
12300800
24681024
49521152
99361024
199360512
400000000
802562048
1610256384
3230793728
6482182144
13005619200
26093879296
52353302528
105038217216
210740707328
422812057600
848289595392
1701918539776
3414532554752
6850489614336
13743895347200
27573757149184
55319715643392
110984370847744
222659694559232
446703442329600
896179286048768
1797911964811264
419904
842402
1690000
3390408
6801664
13645088
27373824
54915200
110166016
221004288
443355136
889407488
1784217600
3579256832
7180189696
14403796992
28894560256
57963315200
116275544064
233249964032
467899777024
938603446272
1882823065600
3776895254528
7576322310144
15197775331328
30485946302464
61152952320000
122668560941056
246063508226048
493581936623616
990078008557568
1985992877670400
463761
930248
1865956
3742848
7507600
15059072
30206016
60588032
121528576
243763200
488940544
980713472
1967099904
3945562112
7913881600
15873343488
31837978624
63858802688
128083820544
256901120000
515271294976
1033484894208
2072862785536
4157528342528
8338695782400
16724736868352
33544298561536
67278515208192
134937403457536
270636626739200
542799040610304
1088653950451712
2183428229300224
509796
1022450
2050624
4112712
8248384
16542752
33177600
66539648
133448704
267637248
536756224
1076480000
2158903296
4329709568
8683257856
17414258688
34924134400
70039764992
140463046656
281694175232
564926611456
1132933939200
2272037699584
4556431818752
9137610031104
18324779958272
36748813926400
73696404307968
147790898397184
296379050098688
594354754289664
1191907111731200
2390218019700736
558009
1119008
2244004
4500000
9024016
18096128
36288576
72770048
145926400
292626432
586802176
1176707072
2359627776
4731699200
9488318464
19026542592
38153027584
76506202112
153413222400
307629129728
616865726464
1236950581248
2480347807744
4973605683200
9973065056256
19997904601088
40099492397056
80406619619328
161229045760000
323290778304512
648249077661696
1299837492396032
2606362248871936
--
330
0.32user 0.02system 0:00.26elapsed 136%CPU (0avgtext+0avgdata 96864maxresident)k
0inputs+0outputs (0major+18507minor)pagefaults 0swaps
time ./rakudo-m --ll-exception -e '
my int @result;
my int @input1 = 450..^4_500;
my int @input2 = |[0..32] xx 10;
say +@result;
say "--";
for ^10_000 { @result = (@input1 Z[+<] @input2) >>*>> @input1 };
.say for @result;
say "--";
say +@result'
0
--
202500
406802
817216
1641672
3297856
6624800
13307904
26732672
53699584
107868672
216678400
435243008
874266624
1756110848
3527409664
7085260800
14231535616
28585361408
57415827456
115322912768
231630438400
465234296832
934423822336
1876774879232
3769437782016
7570718720000
15205257969664
30538425434112
61333206728704
123180198920192
247390116249600
496843964284928
997823982075904
233289
468512
940900
1889568
3794704
7620608
15303744
30732800
61716736
123936768
248882176
499785728
1003622400
2015363072
4046995456
8126595072
16318529536
32768000000
65798406144
132122673152
265299165184
532710162432
1069652377600
2147785637888
4312566595584
8659190939648
17386631593984
34910031052800
70094134706176
140737488355328
282575562080256
567356589867008
1139132701081600
266256
534578
1073296
2154888
4326400
8686112
17438976
35011712
70291456
141120000
283316224
568788992
1141899264
2292457472
4602265600
9239298048
18548260864
37236113408
74751934464
150064332800
301251690496
604753625088
1214016126976
2437066784768
4892236185600
9820744712192
19714168324096
39573962883072
79439715106816
159464082636800
320099617603584
642546434834432
1289795858857984
301401
605000
1214404
2437632
4892944
9821312
19713600
39569408
79423744
159418368
319980544
642252800
1289097216
2587394048
5193220096
10423369728
20920729600
41989701632
84276412416
169147891712
339488014336
681364684800
1367515070464
2744618319872
5508446552064
11055380037632
22187868160000
44530220924928
89369947930624
179359981764608
359962282819584
722413499187200
1449813455405056
338724
679778
1364224
2737800
5494336
11026208
22127616
44405888
89113600
178831872
358875136
720177152
1445216256
2900172800
5819858944
11678810112
23435935744
47028764672
94371840000
189373349888
380008136704
762543341568
1530149208064
3070440243200
6161197694976
12363096915968
24807731101696
49778805178368
99884833177600
200425185738752
402163557728256
806957782925312
1619185490722816
378225
758912
1522756
3055392
6130576
12300800
24681024
49521152
99361024
199360512
400000000
802562048
1610256384
3230793728
6482182144
13005619200
26093879296
52353302528
105038217216
210740707328
422812057600
848289595392
1701918539776
3414532554752
6850489614336
13743895347200
27573757149184
55319715643392
110984370847744
222659694559232
446703442329600
896179286048768
1797911964811264
419904
842402
1690000
3390408
6801664
13645088
27373824
54915200
110166016
221004288
443355136
889407488
1784217600
3579256832
7180189696
14403796992
28894560256
57963315200
116275544064
233249964032
467899777024
938603446272
1882823065600
3776895254528
7576322310144
15197775331328
30485946302464
61152952320000
122668560941056
246063508226048
493581936623616
990078008557568
1985992877670400
463761
930248
1865956
3742848
7507600
15059072
30206016
60588032
121528576
243763200
488940544
980713472
1967099904
3945562112
7913881600
15873343488
31837978624
63858802688
128083820544
256901120000
515271294976
1033484894208
2072862785536
4157528342528
8338695782400
16724736868352
33544298561536
67278515208192
134937403457536
270636626739200
542799040610304
1088653950451712
2183428229300224
509796
1022450
2050624
4112712
8248384
16542752
33177600
66539648
133448704
267637248
536756224
1076480000
2158903296
4329709568
8683257856
17414258688
34924134400
70039764992
140463046656
281694175232
564926611456
1132933939200
2272037699584
4556431818752
9137610031104
18324779958272
36748813926400
73696404307968
147790898397184
296379050098688
594354754289664
1191907111731200
2390218019700736
558009
1119008
2244004
4500000
9024016
18096128
36288576
72770048
145926400
292626432
586802176
1176707072
2359627776
4731699200
9488318464
19026542592
38153027584
76506202112
153413222400
307629129728
616865726464
1236950581248
2480347807744
4973605683200
9973065056256
19997904601088
40099492397056
80406619619328
161229045760000
323290778304512
648249077661696
1299837492396032
2606362248871936
--
330
12.39user 0.03system 0:12.45elapsed 99%CPU (0avgtext+0avgdata 101996maxresident)k
0inputs+0outputs (0major+19487minor)pagefaults 0swaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment