* 仕様書
[REFS[
- [33] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2013-07-27 01:56:00 +09:00]] 版)
]REFS]
* タイマーの精度
[31] 元々は最小でも 10ms とされていましたが、後に実装によっては最小 4ms となり、 >>27
で仕様もそれに揃いました。更に入れ子回数 (タイマーによる処理によって更にタイマー処理を予定した回数)
が4回までは 4ms の制限すらも撤廃されるようになり、仕様も >>24 で追随しています。
[32] なお、いずれにせよ、[[利用者エージェント]]は指定された時間に厳密に従う必要はなく、
利用できる資源の制約や性能上の限界その他の要因により前後する可能性があります。
* 歴史
[2]
[CITE[IRC logs: freenode / #whatwg / 20070409]] ([CODE[2007-04-12 00:04:42 +09:00]] 版)
([[名無しさん]] [WEAK[2007-04-11 15:37:28 +00:00]])
[6]
[CITE@en[Re: Proposal: High resolution (and otherwise improved) timer API]] ([[Maciej Stachowiak]] 著, [CODE[2008-10-04 06:21:35 +09:00]] 版)
>I cannot state with certainty that nothing lower than
10ms is safe. Chrome shipped with a 1ms delay and that was found to
create problems on a number of sites, including nytimes. They are
planning to try 4ms next. We would consider using a lower limit in the
official webkit.org version of WebKit, not not as low as 1ms.
[9] [CITE[IRC logs: freenode / #whatwg / 20090504]]
([TIME[2009-08-05 07:43:45 +09:00]] 版)
[10] [CITE['''['''webkit-dev''']''' setTimeout as browser speed throttle]]
([TIME[2008-10-01 15:56:01 +09:00]] 版)
[12] [CITE@en[Web Applications 1.0 r5535 Allow timers to be delayed when power usage is an issue.Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10633]]
( ([TIME[2010-09-29 07:08:00 +09:00]] 版))
[13] [CITE[Bug 10633 – Minimums for timer granularity should be left to the user agent - different form factors have different power requirements]]
( ([TIME[2010-09-29 07:19:30 +09:00]] 版))
[14] [CITE[''''''[''''''whatwg'''''']'''''' Timeouts and monotonic vs clock time]]
( ([TIME[2011-01-09 13:44:38 +09:00]] 版))
[15] [CITE['''['''whatwg''']''' setTimeout clamps]]
([TIME[2011-01-16 12:00:52 +09:00]] 版)
[16] [CITE@en[Web Applications 1.0 r5879 Define 'this' for setTimeout functions]]
( ([TIME[2011-02-12 08:50:00 +09:00]] 版))
[17] [CITE@en[Web Applications 1.0 r6492 Explain ordering of setTimeout() calls better]]
( ([TIME[2011-08-18 06:36:00 +09:00]] 版))
[18] [CITE@en[Web Applications 1.0 r6899 Make setTimeout() not be well-ordered across multiple browsing contexts, so as to allow user agents to e.g. throttle setTimeout()s in background tabs.]]
( ([TIME[2012-01-18 07:13:00 +09:00]] 版))
[19] [CITE@en[Web Applications 1.0 r6949 Turns out clearTimeout() and clearInterval() are synonyms! Who knew? Oh what a tangled Web we weave.Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=14907]]
( ([TIME[2012-02-01 05:20:00 +09:00]] 版))
[20] [CITE[IRC logs: freenode / #whatwg / 20120626]]
( ([TIME[2012-07-12 23:44:39 +09:00]] 版))
[21] [CITE@en-US[Window Object 1.0]]
( ([TIME[2006-04-08 02:19:28 +09:00]] 版))
[22] [CITE@en[Bug 15007 – Add an API to queue a task]]
( ([TIME[2013-02-09 22:45:48 +09:00]] 版))
[23] [CITE@en[Web Applications 1.0 r7737 Try to more closely match reality.]]
( ([TIME[2013-03-07 08:03:00 +09:00]] 版))
[24] [CITE@en[Web Applications 1.0 r8095 Refactor the timer code to match current practice in WebKit, Gecko, and Blink (the ones whose source I could examine)]]
( ([TIME[2013-07-27 08:27:00 +09:00]] 版))
[25] [CITE[Bug 376643 – setInterval fires repeatedly with incorrectly small delays if machine is suspend/resumed, hibernate/resumed or process is SIGSTOP/SIGCONT]] ([CODE[2007-06-23 10:13:26 +09:00]] 版)
[26] [CITE[HTML5 IRC logs: freenode / #whatwg / 20070622]] ([TIME[2007-06-23 10:17:05 +09:00]] 版)
([[名無しさん]] [WEAK[2007-06-23 01:21:49 +00:00]])
[27] [CITE@en[Web Applications 1.0 r6362 Make setInterval() clamp at 4ms as well.]]
( ([TIME[2011-08-04 08:54:00 +09:00]] 版))
[34] [CITE@en[Efficient Script Yielding]] ([TIME[2013-07-23 11:06:32 +09:00]] 版)
* メモ
[1]
[CITE[Scope of setTimeout Method]]
[7] [CITE[for 文を setTimeout に変換する - IT戦記]] ([TIME[2009-02-02 01:57:56 +09:00]] 版)
[8]
[CITE[JSDeferred を高速化する (試し中) - 冬通りに消え行く制服ガールは、夢物語にリアルを求めない。 - subtech]] ([TIME[2009-03-31 08:34:10 +09:00]] 版)
[28] [CITE[zarame.com/zide/ 日記(2005-11-24)]]
([[名無しさん]] [WEAK[2005-12-07 11:45:55 +00:00]])
[29] [CITE[ぷろじぇくと、みすじら。]]
([[名無しさん]] [WEAK[2005-12-07 11:46:42 +00:00]])
[30] [CITE[zarame.com/zide/ 日記(2005-11-28)]]
([[名無しさん]] [WEAK[2005-12-07 11:46:56 +00:00]])
[35] [CITE[setIntervalとsetTimeoutを調べた結果余分なことになった - 三等兵]]
( ([TIME[2013-07-24 01:30:24 +09:00]] 版))
[36] [CITE@en-US[window.setTimeout - Web API reference | MDN]]
( ([TIME[2013-07-10 02:55:41 +09:00]] 版))
[37] [CITE[Issue 792 - chromium - TRACKING: Chrome does not implement the Webkit 10ms setTimeout clamp. - An open-source project to help move the web forward. - Google Project Hosting]]
( ([TIME[2013-07-27 05:59:41 +09:00]] 版))
[38] [CITE@en-US[David Baron's weblog: setTimeout with a shorter delay]]
( ([TIME[2013-07-27 05:59:54 +09:00]] 版))
[39] [CITE@en[123273 – setTimeout(something, 0) causes 100% CPU constant]]
( ([TIME[2013-07-27 06:07:25 +09:00]] 版))
[40] [CITE@en[686201 – implementation: setImmediate API]]
( ([TIME[2013-07-27 06:16:49 +09:00]] 版))
[41] [CITE@en[839816 – Make next-tick mechanisms like postMessage faster]]
( ([TIME[2013-07-27 06:36:50 +09:00]] 版))
[42] [CITE[''''''[''''''whatwg'''''']'''''' Proposal: requestBackgroundProcessing()]]
( ([TIME[2014-02-20 21:38:44 +09:00]] 版))