{"id":51149756,"url":"https://github.com/sooniln/fastcollect","last_synced_at":"2026-06-26T05:03:39.944Z","repository":{"id":353661363,"uuid":"1219537693","full_name":"sooniln/fastcollect","owner":"sooniln","description":"A library for high-performance primitive collections in the JVM/Kotlin ecosystem.","archived":false,"fork":false,"pushed_at":"2026-06-23T02:52:10.000Z","size":1160,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-23T04:21:41.408Z","etag":null,"topics":["arraylist","collections","hashmap","hashset","hashtable","kotlin-multiplatform","robin-hood-hashing"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/sooniln.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-24T01:21:26.000Z","updated_at":"2026-06-23T02:52:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sooniln/fastcollect","commit_stats":null,"previous_names":["sooniln/fastcollect"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sooniln/fastcollect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooniln%2Ffastcollect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooniln%2Ffastcollect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooniln%2Ffastcollect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooniln%2Ffastcollect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sooniln","download_url":"https://codeload.github.com/sooniln/fastcollect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooniln%2Ffastcollect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34803679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"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":["arraylist","collections","hashmap","hashset","hashtable","kotlin-multiplatform","robin-hood-hashing"],"created_at":"2026-06-26T05:03:37.980Z","updated_at":"2026-06-26T05:03:39.900Z","avatar_url":"https://github.com/sooniln.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maven Central Version](https://img.shields.io/maven-central/v/io.github.sooniln/fastcollect-kotlin)](https://central.sonatype.com/artifact/io.github.sooniln/fastcollect-kotlin)\n[![javadoc](https://javadoc.io/badge2/io.github.sooniln/fastcollect-kotlin/javadoc.svg)](https://javadoc.io/doc/io.github.sooniln/fastcollect-kotlin)\n\n# FastCollect\n\nA library for high-performance primitive collections in the Kotlin ecosystem.\n\nAs a drop-in replacement for standard Kotlin collections, FastCollect generally reduces memory usage by 4–5× and\nimproves CPU performance by 2-4×. Details and benchmarks are available in the performance section below. FastCollect\ndistinguishes itself with a much smaller dependency size (supporting only necessary collections), but performance\ncomparable to much larger and more complex libraries.\n\nFastCollect currently supports the following major platforms (minor platforms have not been listed for brevity, the\nGradle build files are the source of truth):\n\n* jvm\n* js (nodeJs)\n* wasmJs (nodeJs)\n* ios (arm64)\n* ios (x64)\n* linux (x64)\n* linux (arm64)\n* macos (arm64)\n* mingw (x64)\n\nNote that performance has only been tested on JVM platforms.\n\n## Quick Start ##\n\nYou can add FastCollect as a dependency in your project with:\n\n#### Gradle ####\n\n```groovy\nimplementation 'io.github.sooniln:fastcollect-kotlin:2.0.0'\n```\n\n#### Maven ####\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.sooniln\u003c/groupId\u003e\n    \u003cartifactId\u003efastcollect-kotlin\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFastCollect can be used as a (mostly) drop-in replacement for Kotlin standard library collections and should provide\nimmediate memory and CPU improvements without any further changes. You may need to explicitly import FastCollect\nextension functions where standard library extension functions were imported silently, and note that FastCollect\ncurrently does not provide extension methods that create new collections (i.e. filter(), etc...).\n\nUsing FastCollect types should be quite straightforward for anyone familiar with standard Kotlin/Java collections.\nFastCollect provides ArrayList/ArrayDeque, HashSet, and HashMap analogues that can store primitives (and in the case of\nmaps, primitive keys with reference or primitive values).\n\n\u003e [!NOTE]\n\u003e FastCollect currently only supports Int/Long keys for HashSet/HashMap (all types of values are supported). This is\n\u003e done out of a desire to reduce binary size and bloat by eliminating use cases that are unlikely to be very common or\n\u003e useful. If you feel you have a compelling use case that is not currently supported, please reach out, as support is\n\u003e generally trivial to add.\n\n### Examples ###\n\nYou'll find that FastCollect collection usage is pretty much exactly like Kotlin collection usage. A few examples of\ncommon APIs follow:\n\n```kotlin\n// creating a list\nvar list = IntArrayList() // create FastCollect list directly\nlist = mutableIntList(1, 2, 3) // directly create FastCollect list\n\n// get/set by index\nvar i = list[1]\nlist[1] = 2\n\n// search for value in list\nlist.indexOf(1)\nlist.lastIndexOf(2)\nlist.contains(3)\n\n// iterate over list\nfor (i in list) { ... }\n\n// mutate list\nlist.add(5)\nlist.remove(5)\nlist.removeAt(0)\nlist.clear()\n\n// other operations\nlist.sort()\nlist.shuffle()\nlist.fill(0)\n```\n\n```kotlin\n// creating a set\nvar set = IntHashSet() // create FastCollect set directly\nset = mutableIntSetOf(1, 2, 3) // directly create FastCollect set\n\n// search for presence in set\nset.contains(3)\n\n// iterate over set\nfor (i in set) { ... }\n\n// mutate set\nset.add(5)\nset.remove(5)\nset.clear()\n```\n\n```kotlin\n// creating a map\nvar map = Int2IntHashMap() // create FastCollect map directly\nmap = mutableInt2IntMapOf(1 to 2, 2 to 4, 3 to 7) // directly create FastCollect map\n\n// get/set by index\nvar v = map[1]\nmap[1] = 5\n\n// search for key/value in map\nmap.containsKey(1)\nmap.containsValue(2)\n\n// iterate over map\nfor (k in map.keys) { ... }\nfor (v in map.values) { ... }\nfor ((k, v) in map) { ... }\n\n// mutate map\nmap.remove(5)\nmap.clear()\n\n// other operations\nmap.getOrElse(1) { -1 }\n```\n\n### ConcurrentModificationException ###\n\nThe standard JRE libraries make reasonable efforts to throw ConcurrentModificationException if they detect\ncollections being modified in inappropriate ways. This already only a best effort with no guarantees made, but\nFastCollect makes even less of an effort in the interests of performance. Do not expect FastCollect to throw\nConcurrentModificationException if you are shooting yourself in the foot, except in rare instances.\n\n## Performance ##\n\nA key advantage of primitive collections is not just reduced CPU usage, but substantially lower memory usage, which\nhas compounding benefits — more data fitting in CPU caches further reduces memory access latency.\n\nA more detailed examination of performance can be found in the [Performance Benchmarks](docs/PERFORMANCE_BENCHMARKS.md)\ndoc. In benchmarking, FastCollect unsurprisingly outperforms standard Kotlin collections by orders of magnitude (as\nexpected since FastCollect stores primitives, not boxed types).\n\n### Memory Usage ###\n\nA more detailed examination of memory usage can be found in the [Memory Benchmarks](docs/MEMORY_BENCHMARKS.md) doc. The\noverall takeaways are that FastCollect has the lowest memory usage of all benchmarked libraries in virtually all\nscenarios, and especially so with empty/small maps and sets (a scenario not uncommon in many areas of scientific\ncomputing such as graphs, but a consideration that many collections neglect).\n\nMap memory usage as a function of collection size:\n\n![Map Memory Usage](docs/map_memory.svg)\n\n## Generated Code\n\nFastCollect generates most of its collection classes from templates in order to reduce the amount of copy/pasted code\npresent. Contrary to common practice, this project checks the generated code directly into the repository. While this is\nnon-standard from a build pipeline perspective, this project has public APIs composed of generated code, and it is\nimportant for clients and users that the actual code (rather than just the generation templates) is viewable,\nsearchable, and parseable within the repository itself.\n\n## HashSet/HashMap Development Notes\n\nSome extra details on the implementation and development of HashSet/HashMap can be found in the\n[Hashtable Implementation](docs/HASHTABLE_IMPLEMENTATION.md) docs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsooniln%2Ffastcollect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsooniln%2Ffastcollect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsooniln%2Ffastcollect/lists"}