{"id":20906165,"url":"https://github.com/distributedlife/set-interval-behaviour","last_synced_at":"2026-04-21T12:34:16.329Z","repository":{"id":141572899,"uuid":"61510223","full_name":"distributedlife/set-interval-behaviour","owner":"distributedlife","description":"How does setInterval behaviour across implementations of JavaScript","archived":false,"fork":false,"pushed_at":"2016-06-20T03:01:18.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T14:24:05.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/distributedlife.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-20T02:03:28.000Z","updated_at":"2016-06-20T02:28:22.000Z","dependencies_parsed_at":"2024-07-09T18:46:27.249Z","dependency_job_id":null,"html_url":"https://github.com/distributedlife/set-interval-behaviour","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fset-interval-behaviour","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fset-interval-behaviour/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fset-interval-behaviour/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fset-interval-behaviour/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/distributedlife","download_url":"https://codeload.github.com/distributedlife/set-interval-behaviour/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243297635,"owners_count":20268813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T13:29:18.111Z","updated_at":"2025-12-25T13:21:49.482Z","avatar_url":"https://github.com/distributedlife.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\nWhat is the average interval between setInterval callbacks.\n\nIt depends...\n\n# Usage\n\n~~~shell\nnode index.js\n~~~\n\nOr, in your browser:\n\n~~~shell\nopen index.html\n~~~\n\nAfter 10 seconds it reports the result.\n\n# Results\n\n| Implementation | Result |\n| -------------- | ------:|\n| node 6.2.1 | 113.79 |\n| node 5.11.1 | 114.58 |\n| node 4.4.5 |112.83 |\n| node 0.12.14 | 107.28|\n| node 0.10.45 |106.51 |\n| Chrome 51.0.2704.84 |100.02|\n| Firefox 47.0 |101.87|\n| Firefox 45.0.2 |103.36|\n| Firefox 43.0.4 |99.97|\n| Opera 38.0.2220.31 | 100.03 |\n| Opera 37.0.2178.32 | 100.02 |\n| Safari 9.1.1 |103.06|\n\nIt's interesting to note that the time between callbacks on node 4+ is roughly double the length of the callback. While in node 0.12 and 0.10 it's roughly equal to the length of the callback.\n\n# Results (setFixedInterval)\n\nI tried [fixed-setinterval](https://github.com/lfsmoura/fixed-timeout) by [Leo Moura](https://github.com/lfsmoura) to see if I can get more consistent results.\n\n~~~shell\nnode set-fixed-interval.js\n\nopen set-fixed-interval.html\n~~~\n\n| Implementation | Result |\n| -------------- | ------:|\n| node 6.2.1 | 99.98 |\n| Chrome 51.0.2704.84 |100.01|\n| Firefox 47.0 |101.07|\n| Opera 38.0.2220.31 | 100.03 |\n| Safari 9.1.1 |103.21|\n\n# Results (game-loop)\n\nI found another attempt at a consistent interval by [Alex Bennett](https://github.com/timetocode/node-game-loop). For the browser version I had to replace setImmediate with a 0ms setTimeout as most browsers, at the time of writing, don't support setImmediate.\n\n~~~shell\nnode game-loop.js\n\nopen game-loop.html\n~~~\n\n| Implementation | Result |\n| -------------- | ------:|\n| node 6.2.1 | 100.43 |\n| Chrome 51.0.2704.84 |101.93|\n| Firefox 47.0 |102.11|\n| Opera 38.0.2220.31 | 102.04 |\n| Safari 9.1.1 |101.77|","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributedlife%2Fset-interval-behaviour","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistributedlife%2Fset-interval-behaviour","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributedlife%2Fset-interval-behaviour/lists"}