Path: csiph.com!aioe.org!news.mixmin.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: setInterval Date: Tue, 07 Feb 2017 23:19:31 +0100 Organization: PointedEars Software (PES) Lines: 61 Message-ID: <2860782.44csPzL39Z@PointedEars.de> References: <6cb902b0-8913-4b65-954d-5d9f0e60ee95@googlegroups.com> <4cbfae02-e217-436d-8c41-004de444915c@googlegroups.com> <8e741582-e2a8-4713-b49d-6bd5a50a8317@googlegroups.com> <87h947e7f5.fsf@bsb.me.uk> <82f4ba9f-8d80-4769-842a-5a9b066efb5a@googlegroups.com> <5898e78d$0$18070$e4fe514c@newszilla.xs4all.nl> <3141f801-2946-40fc-87ad-97668f7061e4@googlegroups.com> <5012603.DvuYhMxLoT@PointedEars.de> <2548632.e9J7NaK4W3@PointedEars.de> <679dc0d6-92ee-46da-93f0-49790b20cec0@googlegroups.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1486505972 3629 eJwFwYkBgDAIA8CV5ElSxpEK+4/gHYLGqySYWKy+Vw5O3s49rCd6IHKq2p0WJAGt47TM4gcPSg/9 (7 Feb 2017 22:19:32 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 7 Feb 2017 22:19:32 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNwoERACEIA7CVqlLAcQTr/iP8X8LlwzvM6cb3A5txS1Qn9rmNBFrOtNQLG5q9sWYdYdVzRfnmuCRmGD5ZRxUu Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. 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: > >> > 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: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.