big_array
Version, currently main branch1 version
- main branchlatestJul 18, 2025
github.com/jgaskins/big_array
Array type that can hold more than 2**31-1 elements
Installation
# Add this to your shard.yml
dependencies:
big_array:
github: jgaskins/big_array
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.14.0- License
- MIT
- Author
- Jamie Gaskins
Dependencies
This version declares no dependencies.
README
BigArray
The Array type in Crystal can only contain Int32::MAX (2 ** 32 - 1) elements because it uses 32-bit integers for indexing. This is useful for everyday operations, but sometimes you need to account for larger collections.
Installation
-
Add the dependency to your
shard.yml:dependencies: big_array: github: jgaskins/big_array -
Run
shards install
Usage
require "big_array"
Many common operations on Array are supported, such as Enumerable and indexing with [] and related methods, but not all operations are supported yet and some methods will return an Array rather than a BigArray. PRs are welcome.
array = BigArray{1, 2, 3}
array.each do |i|
puts i
end
You probably don't want to use this in place of an Array all the time, and probably only for larger amounts of data. Some operations that are handy for small arrays, mostly quality-of-life methods like to_s and inspect to show the contents of the array, are not and will not be implemented on BigArray because you almost certainly don't want to accidentally output billions of objects to your terminal. If you need those methods, you probably don't also need to hold billions of values in the same data structure.
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/jgaskins/big_array/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Jamie Gaskins - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jul 18, 2025
- Crystal
>= 1.14.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/jgaskins/big_array
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1