Created
July 11, 2017 01:38
-
-
Save eduardopoleo/dd3a37b9609e1b9eff6543a940862af8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'objspace' | |
| # "111...".to_i(2) A 128 "1" | |
| big_int = 340282366920938463463374607431768211455 | |
| ObjectSpace.memsize_of(big_int) # => 40 | |
| array = [true] * 128 | |
| ObjectSpace.memsize_of(big_int) # => 1064 | |
| hash = {"a" => true, "b" => true ...} | |
| ObjectSpace.memsize_of(big_int) # => 6536 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment