{"id":44569859,"url":"https://github.com/fadoli/node-fast-running-stats","last_synced_at":"2026-02-14T02:04:13.172Z","repository":{"id":143748482,"uuid":"417897156","full_name":"Fadoli/node-fast-running-stats","owner":"Fadoli","description":"JavaScript/Node.js library for computing running (or rolling) statistics for one value","archived":false,"fork":false,"pushed_at":"2024-12-10T23:02:57.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-29T21:56:11.714Z","etag":null,"topics":["average","max","mean","min","nodejs","standard-deviation","stats"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@fadoli/node-fast-running-stats","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fadoli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2021-10-16T17:20:26.000Z","updated_at":"2024-12-10T23:02:38.000Z","dependencies_parsed_at":"2024-04-09T23:25:09.868Z","dependency_job_id":null,"html_url":"https://github.com/Fadoli/node-fast-running-stats","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Fadoli/node-fast-running-stats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fadoli%2Fnode-fast-running-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fadoli%2Fnode-fast-running-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fadoli%2Fnode-fast-running-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fadoli%2Fnode-fast-running-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fadoli","download_url":"https://codeload.github.com/Fadoli/node-fast-running-stats/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fadoli%2Fnode-fast-running-stats/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29431593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T22:20:51.549Z","status":"online","status_checked_at":"2026-02-14T02:00:07.626Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["average","max","mean","min","nodejs","standard-deviation","stats"],"created_at":"2026-02-14T02:04:10.567Z","updated_at":"2026-02-14T02:04:13.167Z","avatar_url":"https://github.com/Fadoli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-fast-running-stats\n\nThis is a JavaScript/Node.js library for computing running (or rolling) statistics for one set of values.\n\nAny up to date nodejs compatible runtime should properly work. (bun / nodejs).\n\nNode 18.17.0 or more recent is required (specially for tests), or an up to date bun runtime.\n\nCan be found on :\n\n* [npm](https://www.npmjs.com/package/@fadoli/node-fast-running-stats)\n* [github](https://github.com/Fadoli/node-fast-running-stats)\n\n## Usage\n\n```js\nconst rollingArray = require(\"@fadoli/node-fast-running-stats\");\n\n// We will do stats on a maximum of 10 values (then last value override oldest one)\nconst myStats = new StatsArray(10);\n\nmyStats.append(0).getStats();\n// { n: 1, min: 0, max: 0, sum: 0, mean: 0, variance: 0, standard_deviation: 0 }\nmyStats.append(1).getStats();\n// { n: 2, min: 0, max: 1, sum: 1, mean: 0.5, variance: 0.25, standard_deviation: 0.5 }\n```\n\n## Performance and Results\n\nyou can run this on your machine `npm run bench`\n\nFor each size we run the computation 100 times.\nWe add twice the size one per one and compute the stats each time.\nThis means for size 10 we will compute stats on 1,2,3,4,5,6,7,8,9,10 entries at first, then on 10 entries 10 times.\n\n```\nsimple rollingArray implem, size = 10: 2.903ms\nfastStats implem, size = 10: 3.149ms\n\nsimple rollingArray implem, size = 100: 22.486ms\nfastStats implem, size = 100: 3.946ms\n\nsimple rollingArray implem, size = 1000: 1.318s\nfastStats implem, size = 1000: 10.619ms\n\nsimple rollingArray implem, size = 2000: 4.882s\nfastStats implem, size = 2000: 12.948ms\n\nsimple rollingArray implem, size = 3000: 11.237s\nfastStats implem, size = 3000: 21.145ms\n```\n\nHere is the difference in output when both methods are compared :\n\n```js\n{\n  simple: {\n    n: 3000,\n    min: 0.00009501596644567734,\n    max: 0.9999407084813299,\n    sum: 1514.788964278203,\n    mean: 0.504929654759401,\n    variance: 0.08372214898153563,\n    standard_deviation: 0.28934779933764077\n  },\n  fastStats: {\n    n: 3000,\n    min: 0.00009501596644567734,\n    max: 0.9999407084813299,\n    sum: 1514.7889642781986,\n    mean: 0.5049296547593995,\n    variance: 0.08372328892386063,\n    standard_deviation: 0.28934976917886185\n  }\n}\n```\n\nThis module's approach creates more errors related to the float precision errors (more computation are done and re-used and as such float precision errors are added as times goes on). The result is recomputed after a certain amount of times (2 times the size of the array, or at least 25k) to prevent it from causing big errors.\n\n## Coverage\n\nFile      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|-------------------\nAll files |   98.91 |    96.29 |     100 |   98.91 |\n index.js |   98.91 |    96.29 |     100 |   98.91 | 119-120\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffadoli%2Fnode-fast-running-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffadoli%2Fnode-fast-running-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffadoli%2Fnode-fast-running-stats/lists"}