File tree Expand file tree Collapse file tree 6 files changed +83
-59
lines changed Expand file tree Collapse file tree 6 files changed +83
-59
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ prelude: |
3
3
require "yaml"
4
4
require "net/imap"
5
5
6
- INPUT_COUNT = Integer ENV.fetch("SEQSET_LHS_SIZE", 1000)
7
- MAX_INPUT = Integer ENV.fetch("SEQSET_LHS_MAX", 1400)
6
+ INPUT_COUNT = Integer ENV.fetch("PROFILE_INPUT_COUNT", 1000)
7
+ MAX_INPUT = Integer ENV.fetch("PROFILE_MAX_INPUT", 1400)
8
+ WARMUP_RUNS = Integer ENV.fetch("PROFILE_WARMUP_RUNS", 200)
8
9
9
10
SETS = Array.new(1000) {
10
11
Net::IMAP::SequenceSet[Array.new(INPUT_COUNT) { rand(1..MAX_INPUT) }]
@@ -49,19 +50,17 @@ prelude: |
49
50
end
50
51
end
51
52
52
- # warmup for YJIT
53
- if RubyVM::YJIT.enabled?
54
- 300.times do
55
- lhs, rhs = sets
56
- lhs | rhs
57
- lhs & rhs
58
- lhs - rhs
59
- lhs ^ rhs
60
- ~lhs
61
- lhs.and0 rhs
62
- lhs.and1 rhs
63
- lhs.and2 rhs
64
- end
53
+ # warmup (esp. for JIT)
54
+ WARMUP_RUNS.times do
55
+ lhs, rhs = sets
56
+ lhs | rhs
57
+ lhs & rhs
58
+ lhs - rhs
59
+ lhs ^ rhs
60
+ ~lhs
61
+ lhs.and0 rhs
62
+ lhs.and1 rhs
63
+ lhs.and2 rhs
65
64
end
66
65
67
66
benchmark :
Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ prelude: |
3
3
require "yaml"
4
4
require "net/imap"
5
5
6
- INPUT_COUNT = Integer ENV.fetch("SEQSET_LHS_SIZE", 1000)
7
- MAX_INPUT = Integer ENV.fetch("SEQSET_LHS_MAX", 1400)
6
+ INPUT_COUNT = Integer ENV.fetch("PROFILE_INPUT_COUNT", 1000)
7
+ MAX_INPUT = Integer ENV.fetch("PROFILE_MAX_INPUT", 1400)
8
+ WARMUP_RUNS = Integer ENV.fetch("PROFILE_WARMUP_RUNS", 200)
8
9
9
10
SETS = Array.new(1000) {
10
11
Net::IMAP::SequenceSet[Array.new(INPUT_COUNT) { rand(1..MAX_INPUT) }]
@@ -66,15 +67,13 @@ prelude: |
66
67
end
67
68
end
68
69
69
- # warmup for YJIT
70
- if RubyVM::YJIT.enabled?
71
- 300.times do
72
- ~SETS.sample
73
- SETS.sample.orig_not
74
- SETS.sample.enum_not
75
- SETS.sample.dup.orig_not!
76
- SETS.sample.dup.enum_not!
77
- end
70
+ # warmup (esp. for JIT)
71
+ WARMUP_RUNS.times do
72
+ ~SETS.sample
73
+ SETS.sample.orig_not
74
+ SETS.sample.enum_not
75
+ SETS.sample.dup.orig_not!
76
+ SETS.sample.dup.enum_not!
78
77
end
79
78
80
79
benchmark :
Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ prelude: |
3
3
require "yaml"
4
4
require "net/imap"
5
5
6
- INPUT_COUNT = Integer ENV.fetch("SEQSET_LHS_SIZE", 1000)
7
- MAX_INPUT = Integer ENV.fetch("SEQSET_LHS_MAX", 1400)
6
+ INPUT_COUNT = Integer ENV.fetch("PROFILE_INPUT_COUNT", 1000)
7
+ MAX_INPUT = Integer ENV.fetch("PROFILE_MAX_INPUT", 1400)
8
+ WARMUP_RUNS = Integer ENV.fetch("PROFILE_WARMUP_RUNS", 200)
8
9
9
10
SETS = Array.new(1000) {
10
11
Net::IMAP::SequenceSet[Array.new(INPUT_COUNT) { rand(1..MAX_INPUT) }]
@@ -15,16 +16,14 @@ prelude: |
15
16
[l.dup, r]
16
17
end
17
18
18
- # warmup for YJIT
19
- if RubyVM::YJIT.enabled?
20
- 200.times do
21
- lhs, rhs = sets
22
- lhs | rhs
23
- lhs & rhs
24
- lhs - rhs
25
- lhs ^ rhs
26
- ~lhs
27
- end
19
+ # warmup (esp. for JIT)
20
+ 200.times do
21
+ lhs, rhs = sets
22
+ lhs | rhs
23
+ lhs & rhs
24
+ lhs - rhs
25
+ lhs ^ rhs
26
+ ~lhs
28
27
end
29
28
30
29
benchmark :
@@ -33,7 +32,3 @@ benchmark:
33
32
difference : l, r = sets; l - r
34
33
xor : l, r = sets; l ^ r
35
34
complement : l, _ = sets; ~l
36
-
37
- intersect? : l, r = sets; l.intersect? r
38
- disjoint? : l, r = sets; l.disjoint? r
39
- cover? : l, r = sets; l.cover? r
Original file line number Diff line number Diff line change
1
+ ---
2
+ prelude : |
3
+ require "yaml"
4
+ require "net/imap"
5
+
6
+ INPUT_COUNT = Integer ENV.fetch("PROFILE_INPUT_COUNT", 1000)
7
+ MAX_INPUT = Integer ENV.fetch("PROFILE_MAX_INPUT", 1400)
8
+ WARMUP_RUNS = Integer ENV.fetch("PROFILE_WARMUP_RUNS", 200)
9
+
10
+ SETS = Array.new(1000) {
11
+ Net::IMAP::SequenceSet[Array.new(INPUT_COUNT) { rand(1..MAX_INPUT) }]
12
+ }
13
+
14
+ def sets
15
+ l, r = SETS.sample(2)
16
+ [l.dup, r]
17
+ end
18
+
19
+ # warmup (esp. for JIT)
20
+ WARMUP_RUNS.times do
21
+ lhs, rhs = sets
22
+ lhs | rhs
23
+ lhs & rhs
24
+ lhs - rhs
25
+ lhs ^ rhs
26
+ ~lhs
27
+ end
28
+
29
+ benchmark :
30
+ intersect? : l, r = sets; l.intersect? r
31
+ disjoint? : l, r = sets; l.disjoint? r
32
+ cover? : l, r = sets; l.cover? r
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ prelude: |
27
27
28
28
# warmup
29
29
init n: 100, d: 2
30
- 100 .times do
30
+ 200 .times do
31
31
set[idx]
32
32
set[range]
33
33
set[idx, len]
Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ prelude: |
3
3
require "yaml"
4
4
require "net/imap"
5
5
6
- INPUT_COUNT = Integer ENV.fetch("SEQSET_LHS_SIZE", 1000)
7
- MAX_INPUT = Integer ENV.fetch("SEQSET_LHS_MAX", 1400)
6
+ INPUT_COUNT = Integer ENV.fetch("PROFILE_INPUT_COUNT", 1000)
7
+ MAX_INPUT = Integer ENV.fetch("PROFILE_MAX_INPUT", 1400)
8
+ WARMUP_RUNS = Integer ENV.fetch("PROFILE_WARMUP_RUNS", 200)
8
9
9
10
SETS = Array.new(1000) {
10
11
Net::IMAP::SequenceSet[Array.new(INPUT_COUNT) { rand(1..MAX_INPUT) }]
@@ -54,20 +55,18 @@ prelude: |
54
55
end
55
56
end
56
57
57
- # warmup for YJIT
58
- if RubyVM::YJIT.enabled?
59
- 300.times do
60
- lhs, rhs = sets
61
- lhs | rhs
62
- lhs & rhs
63
- lhs - rhs
64
- lhs ^ rhs
65
- ~lhs
66
- lhs.xor0 rhs
67
- lhs.xor1 rhs
68
- lhs.xor2 rhs
69
- lhs.xor3 rhs
70
- end
58
+ # warmup (esp. for JIT)
59
+ WARMUP_RUNS.times do
60
+ lhs, rhs = sets
61
+ lhs | rhs
62
+ lhs & rhs
63
+ lhs - rhs
64
+ lhs ^ rhs
65
+ ~lhs
66
+ lhs.xor0 rhs
67
+ lhs.xor1 rhs
68
+ lhs.xor2 rhs
69
+ lhs.xor3 rhs
71
70
end
72
71
73
72
benchmark :
You can’t perform that action at this time.
0 commit comments