I have been using Time.every for a project that requires ticks at a 
constant interval. I found that different platforms drift by varying 
amounts. Some platforms seem to oscillate around the desired 0 millisecond 
drift. This is acceptable for my use case. However some platforms 
constantly increase in drift over time. This is unacceptable for my use 
case. 

I put together an example application with Ellie that exhibits the issue (
https://ellie-app.com/3p4mpnVyTj8a1/2). If you compile and open up the 
console you can see how much the application drifts over time in your 
browser. I have a bunch of results from the platforms that I have access 
to. You can see that Safari and Node.js both increase in drift over time:

*Chrome 58.0.3029.110:*

DRIFT: Nothing
DRIFT: Just 4
DRIFT: Just 4
DRIFT: Just -1
DRIFT: Just 0
DRIFT: Just 1
DRIFT: Just 2
DRIFT: Just 3
DRIFT: Just 5
DRIFT: Just 1
DRIFT: Just 3
DRIFT: Just 4
DRIFT: Just -1
DRIFT: Just 1
DRIFT: Just 0
DRIFT: Just 2


*Firefox 47.0:*

DRIFT: Nothing
DRIFT: Just -2
DRIFT: Just 0
DRIFT: Just 2
DRIFT: Just -2
DRIFT: Just -3
DRIFT: Just -1
DRIFT: Just 0
DRIFT: Just -2
DRIFT: Just -3
DRIFT: Just 3
DRIFT: Just -2
DRIFT: Just -3
DRIFT: Just -2
DRIFT: Just -1
DRIFT: Just -2


*Safari 10.1:*

DRIFT: Nothing
DRIFT: Just 0
DRIFT: Just 0
DRIFT: Just 4
DRIFT: Just 3
DRIFT: Just 4
DRIFT: Just 4
DRIFT: Just 4
DRIFT: Just 5
DRIFT: Just 5
DRIFT: Just 6
DRIFT: Just 7
DRIFT: Just 8
DRIFT: Just 9
DRIFT: Just 10
DRIFT: Just 11


*Node.js 7.10.0:*

DRIFT: Nothing
DRIFT: Just 2
DRIFT: Just 5
DRIFT: Just 6
DRIFT: Just 10
DRIFT: Just 17
DRIFT: Just 22
DRIFT: Just 27
DRIFT: Just 32
DRIFT: Just 37
DRIFT: Just 40
DRIFT: Just 43
DRIFT: Just 45
DRIFT: Just 51
DRIFT: Just 54
DRIFT: Just 56


*Node.js 8.0.0:*

DRIFT: Nothing
DRIFT: Just 4
DRIFT: Just 6
DRIFT: Just 7
DRIFT: Just 8
DRIFT: Just 12
DRIFT: Just 14
DRIFT: Just 14
DRIFT: Just 14
DRIFT: Just 20
DRIFT: Just 23
DRIFT: Just 25
DRIFT: Just 25
DRIFT: Just 30
DRIFT: Just 32
DRIFT: Just 37


There are a number of ways I can mitigate the issue but I am wondering 
where is the most pragmatic place for this to be fixed?

*The given platform?*

This would mean Safari, Node and any other inconsistent platforms fix this. 
This seems like it is extremely unlikely to happen. For example this is a 
known issue across multiple node version that was raised almost a year ago 
with no fix yet (https://github.com/nodejs/node/issues/7346).

*Elm's Core Time module?*

This would give consistent behaviour for all consumers no matter what 
platform they are running on. I have made a proof of concept that enables 
this so it is possible. I'm just not sure if this is a change that aligns 
with the intension of the module.

*My application?*

There are a number of things I could do within my application to mitigate 
the issue (which I am already doing). For example I could track the drift 
and counter it in my subscription. My only reservation here is that others 
will face the same issue.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to