{"id":23529724,"url":"https://github.com/jaid/serialize-comparison","last_synced_at":"2026-04-30T06:32:09.255Z","repository":{"id":32435782,"uuid":"133431181","full_name":"Jaid/serialize-comparison","owner":"Jaid","description":"Comparison tools for analyzing performance and efficiency of serialization methods","archived":false,"fork":false,"pushed_at":"2023-01-03T17:48:03.000Z","size":931,"stargazers_count":1,"open_issues_count":15,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-19T05:18:28.669Z","etag":null,"topics":["benchmark","comparison","compressing-objects","compression","deflate","demo","efficiency","node","node-js","nodejs","serialization","serializer","test","zlib"],"latest_commit_sha":null,"homepage":"https://serialize-comparison.jaid.codes/","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/Jaid.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-14T23:02:56.000Z","updated_at":"2020-04-18T03:37:52.000Z","dependencies_parsed_at":"2023-01-14T21:12:45.852Z","dependency_job_id":null,"html_url":"https://github.com/Jaid/serialize-comparison","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Jaid/serialize-comparison","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fserialize-comparison","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fserialize-comparison/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fserialize-comparison/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fserialize-comparison/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaid","download_url":"https://codeload.github.com/Jaid/serialize-comparison/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fserialize-comparison/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261020416,"owners_count":23098143,"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":["benchmark","comparison","compressing-objects","compression","deflate","demo","efficiency","node","node-js","nodejs","serialization","serializer","test","zlib"],"created_at":"2024-12-25T21:12:50.064Z","updated_at":"2026-04-30T06:32:09.214Z","avatar_url":"https://github.com/Jaid.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://serialize-comparison.jaid.codes\"\u003e\n  \u003cimg src=\"./config/icon.png\" alt=\"Logo\"\u003e\n  \u003c/a\u003e\n  serialize-comparison\n\u003c/h1\u003e\n\n[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](./license.txt)\n[![Travis build](https://travis-ci.org/Jaid/serialize-comparison.svg)](https://travis-ci.org/Jaid/serialize-comparison)\n[![npm package](https://img.shields.io/npm/v/serialize-comparison.svg)](https://www.npmjs.com/package/serialize-comparison)\n[![Website](https://img.shields.io/badge/page-jaid.codes-blue.svg)](http://serialize-comparison.jaid.codes)\n[![Donate button](https://img.shields.io/badge/donate-PayPal-ff0080.svg)](https://donate.jaid.codes) [![Greenkeeper badge](https://badges.greenkeeper.io/Jaid/serialize-comparison.svg)](https://greenkeeper.io/)\n\nI was looking for a quick and efficient method of compressing a JavaScript object into a url-safe (actually [url-fragment-safe](https://stackoverflow.com/a/2849800), which seems to allow 77 different characters) string. This was needed to convert a React component state into a permalink (like `example.com/#setStateWithUrlFragmentData`), although React component states are just plain JavaScript objects, so this project is not framework-depended.\n\nThe comparison base currently contains over 160 different methods of compressing objects into strings and corresponding scripts to test those methods regarding performance and compression rate.\n\nYou can find the latest test results over here: [serialize-comparison.jaid.codes](https://serialize-comparison.jaid.codes)\n\n## Winner\n\nThe most efficient way of compressing objects turned out to be [`json5`](https://github.com/json5/json5) as serializer and [`brotli`](https://github.com/MayhemYDG/iltorb) as compression algorithm. The Brotli compressor performs pretty fast and gives insane compression results for a wide spectrum of input data.\n\nExample:\n\n```js\nimport json5 from \"json5\"\nimport { compressSync } from \"iltorb\"\n\nconst data = {a: \"a\", b: 2}\nconst jsonBin = Buffer.from(json5.stringify(data))\nconst compressed = Buffer.from(compressSync(jsonBin)).toString(\"base64\")\n// compressed = \"CwWAe2E6J2EnLGI6Mn0D\"\n```\n\n#### The search is not over\n\nIf you built or know another good [serializer](./src/formatters.js) or [compression algorithm](./src/compressors.js), feel free to suggest it in an [issue](https://github.com/Jaid/serialize-comparison/issues)!\n\n## Command Line\n\nThe CLI script runs the tests locally and prints the top 10 (regarding compression ratio) as an ansi-colored table.\n\nnpx:\n```bash\nnpx serialize-comparison\n```\n\nYarn:\n```bash\nyarn global add serialize-comparison\nserialize-comparison\n```\n\nnpm:\n```bash\nnpm install --global serialize-comparison\nserialize-comparison\n```\n\n![CLI Screenshot](https://i.imgur.com/OczUpoo.png)\n\n## License\n\nCopyright © 2019\nLicensed under [MIT](./license.txt)\nJaid ([github.com/Jaid](https://github.com/Jaid))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaid%2Fserialize-comparison","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaid%2Fserialize-comparison","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaid%2Fserialize-comparison/lists"}