{"id":25359726,"url":"https://github.com/ntrotner/js-heap-comparator","last_synced_at":"2026-02-15T22:05:41.307Z","repository":{"id":276667106,"uuid":"929910280","full_name":"ntrotner/js-heap-comparator","owner":"ntrotner","description":"Compare heaps from different JS runtimes","archived":false,"fork":false,"pushed_at":"2025-03-17T22:11:35.000Z","size":294,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-01T05:05:11.430Z","etag":null,"topics":["heaps","javascript","memory-leak","v8"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/js-heap-comparator","language":"TypeScript","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/ntrotner.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2025-02-09T17:24:14.000Z","updated_at":"2025-03-17T22:11:04.000Z","dependencies_parsed_at":"2025-02-09T18:47:41.501Z","dependency_job_id":null,"html_url":"https://github.com/ntrotner/js-heap-comparator","commit_stats":null,"previous_names":["ntrotner/js-heap-comparator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ntrotner/js-heap-comparator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntrotner%2Fjs-heap-comparator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntrotner%2Fjs-heap-comparator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntrotner%2Fjs-heap-comparator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntrotner%2Fjs-heap-comparator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ntrotner","download_url":"https://codeload.github.com/ntrotner/js-heap-comparator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntrotner%2Fjs-heap-comparator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29490360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["heaps","javascript","memory-leak","v8"],"created_at":"2025-02-14T21:07:35.706Z","updated_at":"2026-02-15T22:05:41.292Z","avatar_url":"https://github.com/ntrotner.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-heap-comparator\n[![Release](https://github.com/ntrotner/js-heap-comparator/actions/workflows/release.yml/badge.svg)](https://github.com/ntrotner/js-heap-comparator/actions/workflows/release.yml)\n[![version](https://img.shields.io/npm/v/js-heap-comparator.svg?style=flat-square)](https://www.npmjs.com/package/js-heap-comparator)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"/docs/assets/i-guess-we-doin-different-runtimes-now.png\" alt=\"Factory worker questioning why someone would compare heaps from different runtimes\" width=\"350\"\u003e\n\u003c/p\u003e\n\n\u003e Compare JS heaps from engines like V8, where the heaps are sourced from different runtimes.\n\nCompatible with heap outputs from Chrome Developer Tools and parsing techniques from [Memlab](https://facebook.github.io/memlab/)\n\n## Install\n\n```bash\nnpm install js-heap-comparator --save-dev\n```\nor\n```bash\nyarn add js-heap-comparator --dev\n```\n\n## Usage\n\nCheck out [examples/compare-heaps.js](examples/compare-heaps.js) for a quick-start.\n\nIt's recommended to use the `--max-old-space-size=8192` flag when running the script to avoid memory issues, especially when multiple threads are used.\n\n### Option: `presenterFilePath`\nOutputs are saved in the `presenterFilePath` directory. Any returns from the compare function are not planned due to the excessive use of memory.\n- `$presenterFilePath/statistics.json`: Contains the statistics of the comparison, e.g. the number of objects, the number of objects that are the same, the number of objects that are different, etc.\n- `$presenterFilePath/perfect-match.json`: Contains the objects that are the same in both heap files.\n- `$presenterFilePath/next-best-match.json`: Contains the objects that are similar in both heap files.\n- `$presenterFilePath/disjunct-nodes.json`: Contains the objects that are different in both heap files.\n\n### Option: `activePresenter`\nToggles the type of presenter to output. The least memory intensive is `statistics`, as only the metadata is saved.\nThe presenter `disjunctNodes` outputs all nodes that couldn't be matches with one another.\nPresenters `perfectMatch` and `nextBestMatch` are bound to change to output matches in an efficient way.\n\n```javascript\nactivePresenter: {\n  statistics: true,\n  perfectMatch: false,\n  nextBestMatch: false,\n  disjunctNodes: false,\n}\n```\n\n### Option: `nextBestMatchObjectThreshold`\nInput value between `0.0` and `1.0`. Defines threshold for next best match algorithm, which ranks the similarity of serializable objects.\nIt's recommended to stay above `0.5` for large heaps.\n\n### Option: `nextBestMatchObjectPropertyThreshold`\nInput value between `1` and `Infinity`. Defines the amount of properties to compare in the next best match algorithm.\nThis allows for optimized comparison times, as serialized objects can be deeply nested and cause unnecessary long execution times.\nFor larger disjunct sets it's recommended to set it between `2500` and `5000`.\n\n### Option: `threads`\nInput value `\u003e= 1`. Used to parallelize next best match algorithm. Adds large memory overhead due to inter-process communication.\nIt's recommended to keep it low between `1` and `4`.\n\n\n```javascript\nimport { V8Comparator } from 'js-heap-comparator';\n\nconst comparator = new V8Comparator();\nheapComparator.initialize({\n  activePresenter: {\n    statistics: true,\n    perfectMatch: false,\n    nextBestMatch: false,\n    disjunctNodes: false,\n  },\n  presenterFilePath: '/path/to/output/results',\n  nextBestMatchObjectThreshold: 0.7,\n  nextBestMatchObjectPropertyThreshold: 10000,\n  threads: 1\n});\nheapComparator.compare('current_heapfile.json', 'next_heapfile.json');\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntrotner%2Fjs-heap-comparator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntrotner%2Fjs-heap-comparator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntrotner%2Fjs-heap-comparator/lists"}