Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32560

Re: setInterval

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: setInterval
Date 2017-02-07 23:19 +0100
Organization PointedEars Software (PES)
Message-ID <2860782.44csPzL39Z@PointedEars.de> (permalink)
References (13 earlier) <o7blfb$vpl$1@dont-email.me> <5012603.DvuYhMxLoT@PointedEars.de> <dcb0bec1-fee0-4745-908d-32f5aec52496@googlegroups.com> <2548632.e9J7NaK4W3@PointedEars.de> <679dc0d6-92ee-46da-93f0-49790b20cec0@googlegroups.com>

Show all headers | View raw


Julio Di Egidio wrote:

> On Tuesday, February 7, 2017 at 9:54:37 PM UTC+1, Thomas 'PointedEars'
> Lahn wrote:

It’s called attribution _line_, not attribution novel.

>> Julio Di Egidio wrote:
> <snip>
>> > the reason being that with setInterval one has to make sure that the
>> > interval delay is not shorter than the job that has to be executed at
>> > every interval, otherwise the browser chokes,
>> 
>> Which browser, and how so?
> 
> I should have said the process chokes, not the browser: that has nothing
> to do with the specific browser, it is just the fact that if the job to
> run at intervals is not guaranteed to run in a time shorter than the
> interval delay, events will rather start piling up and call-backs will
> happen just as fast as the job manages to complete at each iteration.

I can accept that explanation for code that could run asynchronously, e.g. 
if one is assigning to DOM properties that affect rendering.  Which is why I 
have been recommending against using window.setInterval() for smooth 
animations (although scripting is hardly needed these days for animations).

However, at base, ECMAScript function code is still executed in a *single* 
thread.

Are you suggesting that the browser/user agent will, in any case, call a 
copy of the same function again *before* the first call has returned?
If so, in which runtime environments have you observed this behavior?

> But there is even more to it: JS being event-driven,

How did you get that idea?  You have to differentiate between the ECMAScript 
programming language, its implementations, and the language-independent 
interfaces that can be used with the latter.  See my sig.

> the interval provided by setInterval is in fact approximate, and to have a 
> more reliable timing,

I do not see the relation between event-driven programming and 
window.setInterval().  ISTM you are grasping at straws here.

> […]
> And that should be quite enough to convince the casual programmer.

It would be enough to convince the casual programmer, but that is not me.

> The professional has thought out and knows that stuff pretty much since 
> the dawn of the language.

It is equally possible that the so-called professional is actually a wannabe 
and just thinks that he knows what is going on.
 
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

setInterval jonas.thornvall@gmail.com - 2017-02-05 23:26 -0800
  Re: setInterval jonas.thornvall@gmail.com - 2017-02-05 23:30 -0800
    Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 00:17 -0800
      Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 00:24 -0800
        Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 00:36 -0800
          Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 01:10 -0800
            Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 01:20 -0800
              Re: setInterval Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-06 14:10 +0000
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 11:25 -0800
                Re: setInterval Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-06 21:12 +0000
                Re: setInterval Silvio <silvio@internet.com> - 2017-02-06 22:15 +0100
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 14:17 -0800
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:50 +0100
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 20:57 -0800
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 21:15 -0800
                Re: setInterval "Julio P. Di Egidio" <julio@diegidio.name> - 2017-02-07 06:22 +0100
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 22:09 -0800
                Re: setInterval Julio Di Egidio <julio@diegidio.name> - 2017-02-06 22:27 -0800
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 22:45 -0800
                Re: setInterval Jake Jarvis <pig_in_shoes@yahoo.com> - 2017-02-07 11:13 +0100
                Re: setInterval Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-07 17:23 +0100
                Re: setInterval Julio Di Egidio <julio@diegidio.name> - 2017-02-07 11:54 -0800
                Re: setInterval Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-07 21:54 +0100
                Re: setInterval Julio Di Egidio <julio@diegidio.name> - 2017-02-07 13:50 -0800
                Re: setInterval Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-07 23:19 +0100
                Re: setInterval Julio Di Egidio <julio@diegidio.name> - 2017-02-07 15:33 -0800
                Re: setInterval Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-09 00:23 +0100
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-07 11:33 +0100
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:28 +0100
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:26 +0100
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:24 +0100
                Re: setInterval Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-07 04:36 +0100
            Re: setInterval Silvio <silvio@internet.com> - 2017-02-06 16:13 +0100
              Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 12:10 -0800
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 12:27 -0800
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:16 +0100
                Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 14:28 -0800
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:45 +0100
                Re: setInterval Tim Streater <timstreater@greenbee.net> - 2017-02-06 21:25 +0000
                Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:19 +0100
  Re: setInterval JJ <jj4public@vfemail.net> - 2017-02-06 20:07 +0700
    Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 16:00 +0100
      Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 11:06 -0800
        Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:08 +0100
          Re: setInterval jonas.thornvall@gmail.com - 2017-02-06 14:26 -0800
            Re: setInterval "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-06 23:41 +0100

csiph-web