resin 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +2 -0
- data/amber/bin/nodecompile.js +3 -3
- data/amber/css/amber.css +47 -23
- data/amber/images/off.amber.png +0 -0
- data/amber/images/offHover.amber.png +0 -0
- data/amber/images/sprite.amber.png +0 -0
- data/amber/images/tinylogo.amber.png +0 -0
- data/amber/js/Benchfib.deploy.js +34 -34
- data/amber/js/Benchfib.js +49 -49
- data/amber/js/Canvas.deploy.js +937 -937
- data/amber/js/Canvas.js +1622 -1622
- data/amber/js/Compiler-Tests.deploy.js +97 -0
- data/amber/js/Compiler-Tests.js +137 -0
- data/amber/js/Compiler.deploy.js +1030 -924
- data/amber/js/Compiler.js +1613 -1467
- data/amber/js/Documentation.deploy.js +417 -417
- data/amber/js/Documentation.js +728 -728
- data/amber/js/Examples.deploy.js +24 -13
- data/amber/js/Examples.js +36 -19
- data/amber/js/IDE.deploy.js +1583 -1527
- data/amber/js/IDE.js +2586 -2510
- data/amber/js/Kernel-Announcements.deploy.js +19 -19
- data/amber/js/Kernel-Announcements.js +28 -28
- data/amber/js/Kernel-Classes.deploy.js +332 -229
- data/amber/js/Kernel-Classes.js +532 -384
- data/amber/js/Kernel-Collections.deploy.js +1516 -1712
- data/amber/js/Kernel-Collections.js +2436 -2712
- data/amber/js/Kernel-Exceptions.deploy.js +85 -62
- data/amber/js/Kernel-Exceptions.js +131 -98
- data/amber/js/Kernel-Methods.deploy.js +326 -378
- data/amber/js/Kernel-Methods.js +473 -525
- data/amber/js/Kernel-Objects.deploy.js +1777 -2428
- data/amber/js/Kernel-Objects.js +2599 -3426
- data/amber/js/Kernel-Tests.deploy.js +871 -772
- data/amber/js/Kernel-Tests.js +1207 -1083
- data/amber/js/Kernel-Transcript.deploy.js +57 -57
- data/amber/js/Kernel-Transcript.js +94 -94
- data/amber/js/SUnit.deploy.js +116 -116
- data/amber/js/SUnit.js +211 -211
- data/amber/js/amber.js +10 -11
- data/amber/js/boot.js +132 -156
- data/amber/js/init.js +2 -2
- data/amber/js/parser.js +2095 -3014
- data/amber/js/parser.pegjs +1 -1
- data/amber/st/Benchfib.st +22 -22
- data/amber/st/Canvas.st +471 -471
- data/amber/st/Compiler-Tests.st +471 -0
- data/amber/st/Compiler.st +858 -794
- data/amber/st/Examples.st +22 -5
- data/amber/st/IDE.st +1326 -1291
- data/amber/st/Kernel-Announcements.st +2 -2
- data/amber/st/Kernel-Classes.st +148 -90
- data/amber/st/Kernel-Collections.st +950 -1061
- data/amber/st/Kernel-Exceptions.st +33 -25
- data/amber/st/Kernel-Methods.st +151 -151
- data/amber/st/Kernel-Objects.st +891 -1036
- data/amber/st/Kernel-Tests.st +622 -544
- data/amber/st/Kernel-Transcript.st +38 -38
- data/amber/st/SUnit.st +53 -53
- metadata +27 -20
data/README.markdown
CHANGED
data/amber/bin/nodecompile.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
// The arguments variable is a series of .st filenames and category names.
|
3
3
|
// If it is a .st file we import it, if it is a category name we export it
|
4
4
|
// as aCategoryName.js.
|
5
|
-
var
|
5
|
+
var util = require('util'), fs = require('fs');
|
6
6
|
|
7
7
|
// Only care about our arguments, strip away node, all.js and debug flag.
|
8
8
|
var arguments = process.argv.splice(4);
|
@@ -19,11 +19,11 @@ if (suffix == "no-silly-suffix") {
|
|
19
19
|
// If it ends with .st, import it, otherwise export category as .js
|
20
20
|
arguments.forEach(function(val, index, array) {
|
21
21
|
if (/\.st/.test(val)) {
|
22
|
-
|
22
|
+
util.puts("Reading file " + val);
|
23
23
|
code = fs.readFileSync(val, "utf8");
|
24
24
|
smalltalk.Importer._new()._import_(code._stream());
|
25
25
|
} else {
|
26
|
-
|
26
|
+
util.puts("Exporting " + (deploy ? "(debug + deploy)" : "(debug)") + " category "
|
27
27
|
+ val + " as " + val + suffix + ".js" + (deploy ? " and " + val + suffix + ".deploy.js" : ""));
|
28
28
|
fs.writeFileSync(val + suffix + ".js", smalltalk.Exporter._new()._exportPackage_(val));
|
29
29
|
if (deploy) {
|
data/amber/css/amber.css
CHANGED
@@ -2,12 +2,10 @@ body.jtalkBody {
|
|
2
2
|
margin-bottom: 350px;
|
3
3
|
}
|
4
4
|
|
5
|
-
@import url("amber-normalize.css");
|
6
|
-
|
7
5
|
#jtalkTabs, #jtalk .jt_tabs {
|
8
6
|
margin: 0;
|
9
7
|
padding: 0;
|
10
|
-
background: url("../images/sprite.png") #DBD9C9 0 -27px;
|
8
|
+
background: url("../images/sprite.amber.png") #DBD9C9 0 -27px;
|
11
9
|
height: 22px;
|
12
10
|
width: 100%;
|
13
11
|
list-style: none;
|
@@ -18,10 +16,13 @@ body.jtalkBody {
|
|
18
16
|
padding: 0 1px;
|
19
17
|
cursor: pointer;
|
20
18
|
color: #565656;
|
21
|
-
|
22
|
-
|
19
|
+
max-width: 200px;
|
20
|
+
float:left;
|
23
21
|
}
|
22
|
+
#jtalk li {
|
23
|
+
line-height: 14px;
|
24
24
|
|
25
|
+
}
|
25
26
|
#jtalk .ltab, #jtalk .rtab, #jtalk .mtab {
|
26
27
|
height: 22px;
|
27
28
|
float: left;
|
@@ -41,17 +42,17 @@ body.jtalkBody {
|
|
41
42
|
|
42
43
|
#jtalkTabs li:hover .ltab,
|
43
44
|
#jtalk .jt_tabs li:hover .ltab {
|
44
|
-
background: url("../images/sprite.png") -16px -96px;
|
45
|
+
background: url("../images/sprite.amber.png") -16px -96px;
|
45
46
|
}
|
46
47
|
|
47
48
|
#jtalkTabs li:hover .mtab,
|
48
49
|
#jtalk .jt_tabs li:hover .mtab {
|
49
|
-
background: url("../images/sprite.png") 0 -73px;
|
50
|
+
background: url("../images/sprite.amber.png") 0 -73px;
|
50
51
|
}
|
51
52
|
|
52
53
|
#jtalkTabs li:hover .rtab,
|
53
54
|
#jtalk .jt_tabs li:hover .rtab {
|
54
|
-
background: url("../images/sprite.png") -24px -96px;
|
55
|
+
background: url("../images/sprite.amber.png") -24px -96px;
|
55
56
|
}
|
56
57
|
|
57
58
|
#jtalkTabs li.selected,
|
@@ -61,17 +62,17 @@ body.jtalkBody {
|
|
61
62
|
|
62
63
|
#jtalkTabs li.selected .ltab,
|
63
64
|
#jtalk .jt_tabs li.selected .ltab {
|
64
|
-
background: url("../images/sprite.png") 0px -96px;
|
65
|
+
background: url("../images/sprite.amber.png") 0px -96px;
|
65
66
|
}
|
66
67
|
|
67
68
|
#jtalkTabs li.selected .mtab,
|
68
69
|
#jtalk .jt_tabs li.selected .mtab {
|
69
|
-
background: url("../images/sprite.png") 0 -50px;
|
70
|
+
background: url("../images/sprite.amber.png") 0 -50px;
|
70
71
|
}
|
71
72
|
|
72
73
|
#jtalkTabs li.selected .rtab,
|
73
74
|
#jtalk .jt_tabs li.selected .rtab {
|
74
|
-
background: url("../images/sprite.png") -8px -96px;
|
75
|
+
background: url("../images/sprite.amber.png") -8px -96px;
|
75
76
|
}
|
76
77
|
|
77
78
|
#jtalkTabs li .close {
|
@@ -99,12 +100,12 @@ body.jtalkBody {
|
|
99
100
|
left: 8px;
|
100
101
|
width: 22px;
|
101
102
|
height: 20px;
|
102
|
-
background: url("../images/tinylogo.png") top left no-repeat;
|
103
|
+
background: url("../images/tinylogo.amber.png") top left no-repeat;
|
103
104
|
}
|
104
105
|
|
105
106
|
#jtalk #jt_toolbar {
|
106
107
|
height: 27px;
|
107
|
-
background: url("../images/sprite.png") 0 0;
|
108
|
+
background: url("../images/sprite.amber.png") 0 0;
|
108
109
|
}
|
109
110
|
|
110
111
|
#jtalk #jt_toolbar input {
|
@@ -119,12 +120,12 @@ body.jtalkBody {
|
|
119
120
|
top: 6px;
|
120
121
|
width: 16px;
|
121
122
|
height: 16px;
|
122
|
-
background: url('../images/off.png');
|
123
|
+
background: url('../images/off.amber.png');
|
123
124
|
cursor: pointer;
|
124
125
|
}
|
125
126
|
|
126
127
|
#jtalk #jt_toolbar #jt_close:hover {
|
127
|
-
background: url('../images/offHover.png');
|
128
|
+
background: url('../images/offHover.amber.png');
|
128
129
|
}
|
129
130
|
|
130
131
|
|
@@ -168,7 +169,7 @@ body.jtalkBody {
|
|
168
169
|
right: 0;
|
169
170
|
height: 27px;
|
170
171
|
line-height: 27px;
|
171
|
-
background: url("../images/sprite.png") 0 0 repeat;
|
172
|
+
background: url("../images/sprite.amber.png") 0 0 repeat;
|
172
173
|
}
|
173
174
|
|
174
175
|
.jtalkTool .jt_buttons .right {
|
@@ -214,8 +215,20 @@ body.jtalkBody {
|
|
214
215
|
margin-bottom: 0;
|
215
216
|
padding-top: 0;
|
216
217
|
padding-bottom: 0;
|
218
|
+
height: 14px;
|
219
|
+
line-height: normal;
|
220
|
+
box-shadow: none;
|
221
|
+
outline: none;
|
222
|
+
vertical-align:baseline;
|
223
|
+
}
|
224
|
+
.jtalkTool select {
|
225
|
+
height:18px;
|
226
|
+
width: auto;
|
217
227
|
}
|
218
228
|
|
229
|
+
|
230
|
+
|
231
|
+
|
219
232
|
.jtalkTool li {
|
220
233
|
margin: 0;
|
221
234
|
padding: 0;
|
@@ -355,7 +368,7 @@ body.jtalkBody {
|
|
355
368
|
line-height: 1.5em;
|
356
369
|
font-size: 16px;
|
357
370
|
color: red;
|
358
|
-
background: url("../images/sprite.png") top left repeat;
|
371
|
+
background: url("../images/sprite.amber.png") top left repeat;
|
359
372
|
height: 27px;
|
360
373
|
}
|
361
374
|
|
@@ -413,30 +426,37 @@ body.jtalkBody {
|
|
413
426
|
|
414
427
|
.jtalkTool .jt_box .jt_column.implementors,
|
415
428
|
.jtalkTool .jt_box .jt_column.senders,
|
416
|
-
.jtalkTool .jt_box .jt_column.referenced_classes
|
429
|
+
.jtalkTool .jt_box .jt_column.referenced_classes,
|
430
|
+
.jtalkTool .jt_box .jt_column.matches {
|
417
431
|
top: 20px;
|
418
432
|
height: auto;
|
419
433
|
bottom: 0;
|
420
|
-
width:
|
434
|
+
width: 25%;
|
421
435
|
}
|
422
436
|
|
423
437
|
.jtalkTool .jt_box .jt_column.senders {
|
424
|
-
left:
|
438
|
+
left: 25%
|
425
439
|
}
|
426
440
|
|
427
441
|
.jtalkTool .jt_box .jt_column.referenced_classes {
|
428
|
-
left:
|
442
|
+
left: 50%
|
443
|
+
}
|
444
|
+
|
445
|
+
.jtalkTool .jt_box .jt_column.matches {
|
446
|
+
left: 75%
|
429
447
|
}
|
430
448
|
|
431
449
|
.jtalkTool .jt_box .jt_column.implementors .column_label,
|
432
450
|
.jtalkTool .jt_box .jt_column.senders .column_label,
|
433
|
-
.jtalkTool .jt_box .jt_column.referenced_classes .column_label
|
451
|
+
.jtalkTool .jt_box .jt_column.referenced_classes .column_label,
|
452
|
+
.jtalkTool .jt_box .jt_column.matches .column_label {
|
434
453
|
background: #dbdbdb
|
435
454
|
}
|
436
455
|
|
437
456
|
.jtalkTool .jt_box .jt_column.implementors .column_label:hover,
|
438
457
|
.jtalkTool .jt_box .jt_column.senders .column_label:hover,
|
439
|
-
.jtalkTool .jt_box .jt_column.referenced_classes .column_label:hover
|
458
|
+
.jtalkTool .jt_box .jt_column.referenced_classes .column_label:hover,
|
459
|
+
.jtalkTool .jt_box .jt_column.matches .column_label:hover {
|
440
460
|
font-weight: bold;
|
441
461
|
color: #000;
|
442
462
|
cursor: default
|
@@ -520,3 +540,7 @@ body.jtalkBody {
|
|
520
540
|
|
521
541
|
/*.jtalkTool .jt_column.sunit.results ul {padding: 0; margin: 0}*/
|
522
542
|
|
543
|
+
/* Code mirror overrides */
|
544
|
+
.CodeMirror pre {
|
545
|
+
line-height: 14px;
|
546
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/amber/js/Benchfib.deploy.js
CHANGED
@@ -2,23 +2,23 @@ smalltalk.addPackage('Benchfib', {});
|
|
2
2
|
smalltalk.addClass('Benchfib', smalltalk.Object, [], 'Benchfib');
|
3
3
|
|
4
4
|
smalltalk.addMethod(
|
5
|
-
|
5
|
+
"_main",
|
6
6
|
smalltalk.method({
|
7
|
-
selector:
|
7
|
+
selector: "main",
|
8
8
|
fn: function (){
|
9
9
|
var self=this;
|
10
10
|
var result=nil;
|
11
11
|
(result=smalltalk.send((0), "_tinyBenchmarks", []));
|
12
|
-
smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(
|
12
|
+
smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send("0 tinyBenchmarks => ", "__comma", [result])]);
|
13
13
|
return self;}
|
14
14
|
}),
|
15
15
|
smalltalk.Benchfib.klass);
|
16
16
|
|
17
17
|
|
18
18
|
smalltalk.addMethod(
|
19
|
-
|
19
|
+
"_benchFib",
|
20
20
|
smalltalk.method({
|
21
|
-
selector:
|
21
|
+
selector: "benchFib",
|
22
22
|
fn: function (){
|
23
23
|
var self=this;
|
24
24
|
return ((($receiver = self < (2)).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (1);})() : (function(){return ((($receiver = ((($receiver = smalltalk.send(self - (1), "_benchFib", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(self - (2), "_benchFib", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(self - (2), "_benchFib", [])]))).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (1);}), (function(){return ((($receiver = ((($receiver = smalltalk.send(self - (1), "_benchFib", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(self - (2), "_benchFib", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(self - (2), "_benchFib", [])]))).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]));
|
@@ -27,9 +27,9 @@ return self;}
|
|
27
27
|
smalltalk.Number);
|
28
28
|
|
29
29
|
smalltalk.addMethod(
|
30
|
-
|
30
|
+
"_benchmark",
|
31
31
|
smalltalk.method({
|
32
|
-
selector:
|
32
|
+
selector: "benchmark",
|
33
33
|
fn: function (){
|
34
34
|
var self=this;
|
35
35
|
var size=nil;
|
@@ -45,29 +45,9 @@ return self;}
|
|
45
45
|
smalltalk.Number);
|
46
46
|
|
47
47
|
smalltalk.addMethod(
|
48
|
-
|
48
|
+
"_jsbenchFib",
|
49
49
|
smalltalk.method({
|
50
|
-
selector:
|
51
|
-
fn: function (){
|
52
|
-
var self=this;
|
53
|
-
var t1=nil;
|
54
|
-
var t2=nil;
|
55
|
-
var r=nil;
|
56
|
-
var n1=nil;
|
57
|
-
var n2=nil;
|
58
|
-
(n1=(1));
|
59
|
-
(function(){while((function(){(t1=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return smalltalk.send(n1, "_benchmark", []);})]));return ((($receiver = t1).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n1=((($receiver = n1).klass === smalltalk.Number) ? $receiver *(2) : smalltalk.send($receiver, "__star", [(2)])));})()}})();
|
60
|
-
(n2=(16));
|
61
|
-
(function(){while((function(){(t2=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (r=smalltalk.send(n2, "_benchFib", []));})]));return ((($receiver = t2).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n2=((($receiver = n2).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
62
|
-
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [unescape("%20bytecodes/sec%3B%20")]), "__comma", [smalltalk.send(((($receiver = ((($receiver = r).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t2 : smalltalk.send($receiver, "__slash", [t2])), "_printString", [])]), "__comma", [unescape("%20sends/sec")]);
|
63
|
-
return self;}
|
64
|
-
}),
|
65
|
-
smalltalk.Number);
|
66
|
-
|
67
|
-
smalltalk.addMethod(
|
68
|
-
unescape('_jsbenchFib'),
|
69
|
-
smalltalk.method({
|
70
|
-
selector: unescape('jsbenchFib'),
|
50
|
+
selector: "jsbenchFib",
|
71
51
|
fn: function (){
|
72
52
|
var self=this;
|
73
53
|
if (this < 2) {
|
@@ -79,9 +59,9 @@ return self;}
|
|
79
59
|
smalltalk.Number);
|
80
60
|
|
81
61
|
smalltalk.addMethod(
|
82
|
-
|
62
|
+
"_jsbenchmark",
|
83
63
|
smalltalk.method({
|
84
|
-
selector:
|
64
|
+
selector: "jsbenchmark",
|
85
65
|
fn: function (){
|
86
66
|
var self=this;
|
87
67
|
|
@@ -111,9 +91,9 @@ return self;}
|
|
111
91
|
smalltalk.Number);
|
112
92
|
|
113
93
|
smalltalk.addMethod(
|
114
|
-
|
94
|
+
"_jstinyBenchmarks",
|
115
95
|
smalltalk.method({
|
116
|
-
selector:
|
96
|
+
selector: "jstinyBenchmarks",
|
117
97
|
fn: function (){
|
118
98
|
var self=this;
|
119
99
|
var t1=nil;
|
@@ -125,7 +105,27 @@ var n2=nil;
|
|
125
105
|
(function(){while((function(){(t1=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return smalltalk.send(n1, "_jsbenchmark", []);})]));return ((($receiver = t1).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n1=((($receiver = n1).klass === smalltalk.Number) ? $receiver *(2) : smalltalk.send($receiver, "__star", [(2)])));})()}})();
|
126
106
|
(n2=(28));
|
127
107
|
(function(){while((function(){(t2=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (r=smalltalk.send(n2, "_jsbenchFib", []));})]));return ((($receiver = t2).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n2=((($receiver = n2).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
128
|
-
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [
|
108
|
+
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [" bytecodes/sec; "]), "__comma", [smalltalk.send(((($receiver = ((($receiver = r).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t2 : smalltalk.send($receiver, "__slash", [t2])), "_printString", [])]), "__comma", [" sends/sec"]);
|
109
|
+
return self;}
|
110
|
+
}),
|
111
|
+
smalltalk.Number);
|
112
|
+
|
113
|
+
smalltalk.addMethod(
|
114
|
+
"_tinyBenchmarks",
|
115
|
+
smalltalk.method({
|
116
|
+
selector: "tinyBenchmarks",
|
117
|
+
fn: function (){
|
118
|
+
var self=this;
|
119
|
+
var t1=nil;
|
120
|
+
var t2=nil;
|
121
|
+
var r=nil;
|
122
|
+
var n1=nil;
|
123
|
+
var n2=nil;
|
124
|
+
(n1=(1));
|
125
|
+
(function(){while((function(){(t1=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return smalltalk.send(n1, "_benchmark", []);})]));return ((($receiver = t1).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n1=((($receiver = n1).klass === smalltalk.Number) ? $receiver *(2) : smalltalk.send($receiver, "__star", [(2)])));})()}})();
|
126
|
+
(n2=(16));
|
127
|
+
(function(){while((function(){(t2=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (r=smalltalk.send(n2, "_benchFib", []));})]));return ((($receiver = t2).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n2=((($receiver = n2).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
128
|
+
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [" bytecodes/sec; "]), "__comma", [smalltalk.send(((($receiver = ((($receiver = r).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t2 : smalltalk.send($receiver, "__slash", [t2])), "_printString", [])]), "__comma", [" sends/sec"]);
|
129
129
|
return self;}
|
130
130
|
}),
|
131
131
|
smalltalk.Number);
|
data/amber/js/Benchfib.js
CHANGED
@@ -2,44 +2,44 @@ smalltalk.addPackage('Benchfib', {});
|
|
2
2
|
smalltalk.addClass('Benchfib', smalltalk.Object, [], 'Benchfib');
|
3
3
|
|
4
4
|
smalltalk.addMethod(
|
5
|
-
|
5
|
+
"_main",
|
6
6
|
smalltalk.method({
|
7
|
-
selector:
|
7
|
+
selector: "main",
|
8
8
|
category: 'not yet classified',
|
9
9
|
fn: function (){
|
10
10
|
var self=this;
|
11
11
|
var result=nil;
|
12
12
|
(result=smalltalk.send((0), "_tinyBenchmarks", []));
|
13
|
-
smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(
|
13
|
+
smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send("0 tinyBenchmarks => ", "__comma", [result])]);
|
14
14
|
return self;},
|
15
15
|
args: [],
|
16
|
-
source:
|
17
|
-
messageSends: ["tinyBenchmarks", "log:",
|
16
|
+
source: "main\x0a\x0a\x09| result |\x0a\x09result := 0 tinyBenchmarks.\x0a\x09console log: '0 tinyBenchmarks => ' , result",
|
17
|
+
messageSends: ["tinyBenchmarks", "log:", ","],
|
18
18
|
referencedClasses: []
|
19
19
|
}),
|
20
20
|
smalltalk.Benchfib.klass);
|
21
21
|
|
22
22
|
|
23
23
|
smalltalk.addMethod(
|
24
|
-
|
24
|
+
"_benchFib",
|
25
25
|
smalltalk.method({
|
26
|
-
selector:
|
26
|
+
selector: "benchFib",
|
27
27
|
category: '*Benchfib',
|
28
28
|
fn: function (){
|
29
29
|
var self=this;
|
30
30
|
return ((($receiver = self < (2)).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (1);})() : (function(){return ((($receiver = ((($receiver = smalltalk.send(self - (1), "_benchFib", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(self - (2), "_benchFib", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(self - (2), "_benchFib", [])]))).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (1);}), (function(){return ((($receiver = ((($receiver = smalltalk.send(self - (1), "_benchFib", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(self - (2), "_benchFib", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(self - (2), "_benchFib", [])]))).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]));
|
31
31
|
return self;},
|
32
32
|
args: [],
|
33
|
-
source:
|
34
|
-
messageSends: ["ifTrue:ifFalse:",
|
33
|
+
source: "benchFib \x0a\x09\x22Handy send-heavy benchmark\x22\x0a\x09\x22(result // seconds to run) = approx calls per second\x22\x0a\x09\x22 | r t |\x0a\x09 t := Time millisecondsToRun: [r := 26 benchFib].\x0a\x09 (r * 1000) // t\x22\x0a\x09\x22138000 on a Mac 8100/100\x22\x0a\x09^ self < 2 \x0a\x09\x09ifTrue: [1] \x0a\x09\x09ifFalse: [(self-1) benchFib + (self-2) benchFib + 1]",
|
34
|
+
messageSends: ["ifTrue:ifFalse:", "<", "+", "benchFib", "-"],
|
35
35
|
referencedClasses: []
|
36
36
|
}),
|
37
37
|
smalltalk.Number);
|
38
38
|
|
39
39
|
smalltalk.addMethod(
|
40
|
-
|
40
|
+
"_benchmark",
|
41
41
|
smalltalk.method({
|
42
|
-
selector:
|
42
|
+
selector: "benchmark",
|
43
43
|
category: '*Benchfib',
|
44
44
|
fn: function (){
|
45
45
|
var self=this;
|
@@ -53,41 +53,16 @@ smalltalk.send((1), "_to_do_", [self, (function(iter){(count=(0));(flags=smallta
|
|
53
53
|
return count;
|
54
54
|
return self;},
|
55
55
|
args: [],
|
56
|
-
source:
|
57
|
-
messageSends: ["to:do:", "new", "timesRepeat:", "add:", "ifTrue:", "at:",
|
56
|
+
source: "benchmark \x0a\x09\x22Handy bytecode-heavy benchmark\x22\x0a\x09\x22(500000 // time to run) = approx bytecodes per second\x22\x0a\x09\x225000000 // (Time millisecondsToRun: [10 benchmark]) * 1000\x22\x0a\x09\x223059000 on a Mac 8100/100\x22\x0a | size flags prime k count |\x0a size := 8190.\x0a 1 to: self do:\x0a [:iter |\x0a count := 0.\x0a flags := Array new.\x0a size timesRepeat: [ flags add: true].\x0a 1 to: size do:\x0a [:i | (flags at: i) ifTrue:\x0a [prime := i+1.\x0a k := i + prime.\x0a [k <= size] whileTrue:\x0a [flags at: k put: false.\x0a k := k + prime].\x0a count := count + 1]]].\x0a ^ count",
|
57
|
+
messageSends: ["to:do:", "new", "timesRepeat:", "add:", "ifTrue:", "at:", "+", "whileTrue:", "<=", "at:put:"],
|
58
58
|
referencedClasses: ["Array"]
|
59
59
|
}),
|
60
60
|
smalltalk.Number);
|
61
61
|
|
62
62
|
smalltalk.addMethod(
|
63
|
-
|
63
|
+
"_jsbenchFib",
|
64
64
|
smalltalk.method({
|
65
|
-
selector:
|
66
|
-
category: '*Benchfib',
|
67
|
-
fn: function (){
|
68
|
-
var self=this;
|
69
|
-
var t1=nil;
|
70
|
-
var t2=nil;
|
71
|
-
var r=nil;
|
72
|
-
var n1=nil;
|
73
|
-
var n2=nil;
|
74
|
-
(n1=(1));
|
75
|
-
(function(){while((function(){(t1=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return smalltalk.send(n1, "_benchmark", []);})]));return ((($receiver = t1).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n1=((($receiver = n1).klass === smalltalk.Number) ? $receiver *(2) : smalltalk.send($receiver, "__star", [(2)])));})()}})();
|
76
|
-
(n2=(16));
|
77
|
-
(function(){while((function(){(t2=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (r=smalltalk.send(n2, "_benchFib", []));})]));return ((($receiver = t2).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n2=((($receiver = n2).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
78
|
-
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [unescape("%20bytecodes/sec%3B%20")]), "__comma", [smalltalk.send(((($receiver = ((($receiver = r).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t2 : smalltalk.send($receiver, "__slash", [t2])), "_printString", [])]), "__comma", [unescape("%20sends/sec")]);
|
79
|
-
return self;},
|
80
|
-
args: [],
|
81
|
-
source: unescape('tinyBenchmarks%20%0A%09%22Report%20the%20results%20of%20running%20the%20two%20tiny%20Squeak%20benchmarks.%0A%09ar%209/10/1999%3A%20Adjusted%20to%20run%20at%20least%201%20sec%20to%20get%20more%20stable%20results%22%0A%09%220%20tinyBenchmarks%22%0A%09%22On%20a%20292%20MHz%20G3%20Mac%3A%2022727272%20bytecodes/sec%3B%20984169%20sends/sec%22%0A%09%22On%20a%20400%20MHz%20PII/Win98%3A%20%2018028169%20bytecodes/sec%3B%201081272%20sends/sec%22%0A%09%7C%20t1%20t2%20r%20n1%20n2%20%7C%0A%09n1%20%3A%3D%201.%0A%09%5Bt1%20%3A%3D%20Date%20millisecondsToRun%3A%20%5Bn1%20benchmark%5D.%0A%09t1%20%3C%201000%5D%20whileTrue%3A%5Bn1%20%3A%3D%20n1%20*%202%5D.%20%22Note%3A%20%23benchmark%27s%20runtime%20is%20about%20O%28n%29%22%0A%0A%09n2%20%3A%3D%2016.%0A%09%5Bt2%20%3A%3D%20Date%20millisecondsToRun%3A%20%5Br%20%3A%3D%20n2%20benchFib%5D.%0A%09t2%20%3C%201000%5D%20whileTrue%3A%5Bn2%20%3A%3D%20n2%20+%201%5D.%20%0A%09%22Note%3A%20%23benchFib%27s%20runtime%20is%20about%20O%28k%5En%29%2C%0A%09%09where%20k%20is%20the%20golden%20number%20%3D%20%281%20+%205%20sqrt%29%20/%202%20%3D%201.618....%22%0A%0A%09%5E%20%28%28n1%20*%20500000%20*%201000%29%20/%20t1%29%20printString%2C%20%27%20bytecodes/sec%3B%20%27%2C%0A%09%20%20%28%28r%20*%201000%29%20/%20t2%29%20printString%2C%20%27%20sends/sec%27'),
|
82
|
-
messageSends: ["whileTrue:", "millisecondsToRun:", "benchmark", unescape("%3C"), unescape("*"), "benchFib", unescape("+"), unescape("%2C"), "printString", unescape("/")],
|
83
|
-
referencedClasses: ["Date"]
|
84
|
-
}),
|
85
|
-
smalltalk.Number);
|
86
|
-
|
87
|
-
smalltalk.addMethod(
|
88
|
-
unescape('_jsbenchFib'),
|
89
|
-
smalltalk.method({
|
90
|
-
selector: unescape('jsbenchFib'),
|
65
|
+
selector: "jsbenchFib",
|
91
66
|
category: '*Benchfib',
|
92
67
|
fn: function (){
|
93
68
|
var self=this;
|
@@ -97,16 +72,16 @@ return 1;
|
|
97
72
|
return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;};
|
98
73
|
return self;},
|
99
74
|
args: [],
|
100
|
-
source:
|
75
|
+
source: "jsbenchFib\x0a \x0a\x09<if (this < 2) {\x0areturn 1;\x0a} else {\x0areturn (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;}>",
|
101
76
|
messageSends: [],
|
102
77
|
referencedClasses: []
|
103
78
|
}),
|
104
79
|
smalltalk.Number);
|
105
80
|
|
106
81
|
smalltalk.addMethod(
|
107
|
-
|
82
|
+
"_jsbenchmark",
|
108
83
|
smalltalk.method({
|
109
|
-
selector:
|
84
|
+
selector: "jsbenchmark",
|
110
85
|
category: '*Benchfib',
|
111
86
|
fn: function (){
|
112
87
|
var self=this;
|
@@ -134,16 +109,16 @@ for (var z=0;z<this;z++) {
|
|
134
109
|
return count;
|
135
110
|
return self;},
|
136
111
|
args: [],
|
137
|
-
source:
|
112
|
+
source: "jsbenchmark\x0a\x0a<\x0avar size = 8190;\x0avar count;\x0afor (var z=0;z<this;z++) {\x0a count = 0;\x0a var flags = new Array();\x0a for (var p=0; p<size; p++) {\x0a flags[p] = true;\x0a }\x0a for (var i=1;i<=size;i++) {\x0a if (flags[i-1]) {\x0a var prime = i+1;\x0a var k = i + prime;\x0a while (k <= size) {\x0a flags[k-1] = false;\x0a k = k + prime;\x0a }\x0a count = count + 1;\x0a }\x0a }\x0a}\x0areturn count>",
|
138
113
|
messageSends: [],
|
139
114
|
referencedClasses: []
|
140
115
|
}),
|
141
116
|
smalltalk.Number);
|
142
117
|
|
143
118
|
smalltalk.addMethod(
|
144
|
-
|
119
|
+
"_jstinyBenchmarks",
|
145
120
|
smalltalk.method({
|
146
|
-
selector:
|
121
|
+
selector: "jstinyBenchmarks",
|
147
122
|
category: '*Benchfib',
|
148
123
|
fn: function (){
|
149
124
|
var self=this;
|
@@ -156,11 +131,36 @@ var n2=nil;
|
|
156
131
|
(function(){while((function(){(t1=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return smalltalk.send(n1, "_jsbenchmark", []);})]));return ((($receiver = t1).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n1=((($receiver = n1).klass === smalltalk.Number) ? $receiver *(2) : smalltalk.send($receiver, "__star", [(2)])));})()}})();
|
157
132
|
(n2=(28));
|
158
133
|
(function(){while((function(){(t2=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (r=smalltalk.send(n2, "_jsbenchFib", []));})]));return ((($receiver = t2).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n2=((($receiver = n2).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
159
|
-
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [
|
134
|
+
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [" bytecodes/sec; "]), "__comma", [smalltalk.send(((($receiver = ((($receiver = r).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t2 : smalltalk.send($receiver, "__slash", [t2])), "_printString", [])]), "__comma", [" sends/sec"]);
|
135
|
+
return self;},
|
136
|
+
args: [],
|
137
|
+
source: "jstinyBenchmarks\x0a\x09\x220 jstinyBenchmarks\x22\x0a\x0a\x09| t1 t2 r n1 n2 |\x0a\x09n1 := 1.\x0a\x09[t1 := Date millisecondsToRun: [n1 jsbenchmark].\x0a\x09t1 < 1000] whileTrue:[n1 := n1 * 2]. \x22Note: #benchmark's runtime is about O(n)\x22\x0a\x0a\x09n2 := 28.\x0a\x09[t2 := Date millisecondsToRun: [r := n2 jsbenchFib].\x0a\x09t2 < 1000] whileTrue:[n2 := n2 + 1]. \x0a\x09\x22Note: #jsbenchFib's runtime is about O(k^n),\x0a\x09\x09where k is the golden number = (1 + 5 sqrt) / 2 = 1.618....\x22\x0a\x0a\x09^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',\x0a\x09 ((r * 1000) / t2) printString, ' sends/sec'",
|
138
|
+
messageSends: ["whileTrue:", "millisecondsToRun:", "jsbenchmark", "<", "*", "jsbenchFib", "+", ",", "printString", "/"],
|
139
|
+
referencedClasses: ["Date"]
|
140
|
+
}),
|
141
|
+
smalltalk.Number);
|
142
|
+
|
143
|
+
smalltalk.addMethod(
|
144
|
+
"_tinyBenchmarks",
|
145
|
+
smalltalk.method({
|
146
|
+
selector: "tinyBenchmarks",
|
147
|
+
category: '*Benchfib',
|
148
|
+
fn: function (){
|
149
|
+
var self=this;
|
150
|
+
var t1=nil;
|
151
|
+
var t2=nil;
|
152
|
+
var r=nil;
|
153
|
+
var n1=nil;
|
154
|
+
var n2=nil;
|
155
|
+
(n1=(1));
|
156
|
+
(function(){while((function(){(t1=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return smalltalk.send(n1, "_benchmark", []);})]));return ((($receiver = t1).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n1=((($receiver = n1).klass === smalltalk.Number) ? $receiver *(2) : smalltalk.send($receiver, "__star", [(2)])));})()}})();
|
157
|
+
(n2=(16));
|
158
|
+
(function(){while((function(){(t2=smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (r=smalltalk.send(n2, "_benchFib", []));})]));return ((($receiver = t2).klass === smalltalk.Number) ? $receiver <(1000) : smalltalk.send($receiver, "__lt", [(1000)]));})()) {(function(){return (n2=((($receiver = n2).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
159
|
+
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(((($receiver = ((($receiver = ((($receiver = n1).klass === smalltalk.Number) ? $receiver *(500000) : smalltalk.send($receiver, "__star", [(500000)]))).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t1 : smalltalk.send($receiver, "__slash", [t1])), "_printString", []), "__comma", [" bytecodes/sec; "]), "__comma", [smalltalk.send(((($receiver = ((($receiver = r).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))).klass === smalltalk.Number) ? $receiver /t2 : smalltalk.send($receiver, "__slash", [t2])), "_printString", [])]), "__comma", [" sends/sec"]);
|
160
160
|
return self;},
|
161
161
|
args: [],
|
162
|
-
source:
|
163
|
-
messageSends: ["whileTrue:", "millisecondsToRun:", "
|
162
|
+
source: "tinyBenchmarks \x0a\x09\x22Report the results of running the two tiny Squeak benchmarks.\x0a\x09ar 9/10/1999: Adjusted to run at least 1 sec to get more stable results\x22\x0a\x09\x220 tinyBenchmarks\x22\x0a\x09\x22On a 292 MHz G3 Mac: 22727272 bytecodes/sec; 984169 sends/sec\x22\x0a\x09\x22On a 400 MHz PII/Win98: 18028169 bytecodes/sec; 1081272 sends/sec\x22\x0a\x09| t1 t2 r n1 n2 |\x0a\x09n1 := 1.\x0a\x09[t1 := Date millisecondsToRun: [n1 benchmark].\x0a\x09t1 < 1000] whileTrue:[n1 := n1 * 2]. \x22Note: #benchmark's runtime is about O(n)\x22\x0a\x0a\x09n2 := 16.\x0a\x09[t2 := Date millisecondsToRun: [r := n2 benchFib].\x0a\x09t2 < 1000] whileTrue:[n2 := n2 + 1]. \x0a\x09\x22Note: #benchFib's runtime is about O(k^n),\x0a\x09\x09where k is the golden number = (1 + 5 sqrt) / 2 = 1.618....\x22\x0a\x0a\x09^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',\x0a\x09 ((r * 1000) / t2) printString, ' sends/sec'",
|
163
|
+
messageSends: ["whileTrue:", "millisecondsToRun:", "benchmark", "<", "*", "benchFib", "+", ",", "printString", "/"],
|
164
164
|
referencedClasses: ["Date"]
|
165
165
|
}),
|
166
166
|
smalltalk.Number);
|