Skip to content

Commit a563731

Browse files
committed
Remove requestAnimationFrame optimization from Gren and Elm, for fair benchmark.
1 parent c12d028 commit a563731

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

implementations/elm-0.19.1/dist/elm.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,26 +4023,10 @@ function _Browser_makeAnimator(model, draw)
40234023
{
40244024
draw(model);
40254025

4026-
var state = 0;
4027-
4028-
function updateIfNeeded()
4029-
{
4030-
state = state === 1
4031-
? 0
4032-
: ( _Browser_requestAnimationFrame(updateIfNeeded), draw(model), 1 );
4033-
}
4034-
40354026
return function(nextModel, isSync)
40364027
{
40374028
model = nextModel;
4038-
4039-
isSync
4040-
? ( draw(model),
4041-
state === 2 && (state = 1)
4042-
)
4043-
: ( state === 0 && _Browser_requestAnimationFrame(updateIfNeeded),
4044-
state = 2
4045-
);
4029+
draw(model);
40464030
};
40474031
}
40484032

@@ -5911,4 +5895,4 @@ _Platform_export({'Main':{'init':$author$project$Main$main(
59115895
A2($elm$json$Json$Decode$field, 'uid', $elm$json$Json$Decode$int));
59125896
},
59135897
A2($elm$json$Json$Decode$field, 'visibility', $elm$json$Json$Decode$string)))
5914-
])))(0)}});}(this));
5898+
])))(0)}});}(this));

implementations/gren-0.5.5/gren.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,9 @@ function _Browser_makeAnimator(model, draw) {
169169

170170
var state = 0;
171171

172-
function updateIfNeeded() {
173-
state =
174-
state === 1
175-
? 0
176-
: (_Browser_requestAnimationFrame(updateIfNeeded),
177-
draw(model),
178-
1);
179-
}
180-
181172
return function (nextModel, isSync) {
182173
model = nextModel;
183-
184-
isSync
185-
? (draw(model),
186-
state === 2 && (state = 1))
187-
: (state === 0 &&
188-
_Browser_requestAnimationFrame(updateIfNeeded),
189-
(state = 2));
174+
draw(model);
190175
};
191176
}
192177

@@ -4757,4 +4742,4 @@ var $author$project$Todo$main = $gren_lang$browser$Browser$element({ a_: functio
47574742
}, bm: function(_v1) {
47584743
return $gren_lang$core$Platform$Sub$none;
47594744
}, bo: $author$project$Todo$update, bq: $author$project$Todo$view });
4760-
_Platform_export({'Todo':{'init':$author$project$Todo$main($gren_lang$core$Json$Decode$succeed({ }))}});}(this.module ? this.module.exports : this));
4745+
_Platform_export({'Todo':{'init':$author$project$Todo$main($gren_lang$core$Json$Decode$succeed({ }))}});}(this.module ? this.module.exports : this));

0 commit comments

Comments
 (0)