Created
July 22, 2021 16:34
-
-
Save aergonaut/bc615231884c232a520f23e76d6ac1c3 to your computer and use it in GitHub Desktop.
This file contains 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
GC.start | |
before = GC.stat(:total_freed_objects) | |
100_000.times do | |
foo = "a string" | |
end | |
GC.start | |
after = GC.stat(:total_freed_objects) | |
puts "(Creating Strings) Objects Freed: #{after - before}" | |
GC.start | |
before = GC.stat(:total_freed_objects) | |
foo = "a string" | |
100_000.times do | |
bar = foo.to_sym | |
end | |
GC.start | |
after = GC.stat(:total_freed_objects) | |
puts "(Calling to_sym) Objects Freed: #{after - before}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment