forked from pharo-project/pharo
/
EFBenchTest.class.st
84 lines (66 loc) · 1.91 KB
/
EFBenchTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Class {
#name : #EFBenchTest,
#superclass : #TestCase,
#category : #'EnlumineurFormatter-Tests'
}
{ #category : #tests }
EFBenchTest >> basicMethod [
[[[[[ [
[ :y :z |
[ :x | 1 to: 10 do: [:i | Transcript show:i ; cr ;cr] ]]]
]]]]]
]
{ #category : #tests }
EFBenchTest >> basicMethod2 [
<sampleInstance>
1 to: 10 do: [:i | Transcript show:i ; cr ;cr]
]
{ #category : #tests }
EFBenchTest >> basicMethod3 [
"a method with many similar expressions."
| x y |
x to: y do: [:i | Transcript show:i ; cr ;cr].
x to: y do: [:i | Transcript show:i ; cr ;cr].
x to: y do: [:i | Transcript show:i ; cr: x ; cr: x ].
]
{ #category : #resources }
EFBenchTest >> longNestedMethod [
self foo: [ :b1 |
b1 value: [ :b2 |
b2 value: [ :b3 |
b2 value: [ :b4 |
b3 value: [ :b5 |
b4 value: [ :b6 |
b5 value: [ :b7 |
b6 value: [ :b8|
b7 value: [ :b9 |
b8 value: [ :b10 |
b9 value: 2] ] ] ]] ] ] ] ] ]
]
{ #category : #resources }
EFBenchTest >> longNestedMethodShort [
| b0 |
self value: [:b1 | b0 value: [:b2 | b1 value: [:b3 | b2 value: [:b4 | b3 value: [:b5 | b4 value: [:b6 | b5 value: [:b7 | b7 value: 2 ] ] ] ] ] ] ]
]
{ #category : #tests }
EFBenchTest >> testBasicBlueInk [
BIConfigurableFormatter format: (EFBenchTest >> #basicMethod) ast
]
{ #category : #tests }
EFBenchTest >> testBasicEF [
self skip.
[ EFFormatter format: (EFBenchTest >> #basicMethod) ast ] bench
]
{ #category : #tests }
EFBenchTest >> testBasicEF2 [
EFFormatter format: (EFBenchTest >> #basicMethod2) ast
]
{ #category : #tests }
EFBenchTest >> testEF [
"
[ EFFormatter format: (EFBenchTest >> #longNestedMethodShort) ast ] bench '0.159 per second'
[ RBSimpleFormatter format: (EFBenchTest >> #longNestedMethodShort) ast ] bench
>>>'15597.361 per second'
[ BIConfigurableFormatter format: (EFBenchTest >> #longNestedMethodShort) ast ] bench '7341.000 per second'
"
]