Strange Hash Instances in Ruby
Related
More from Kate Murphy
After investigating the CRuby source code for hash tables, my interest was piqued, and I decided to look into another hash table implementation before leaving Recurse Center. I chose to investigate Lua because the hash table is the central abstraction of the language. I don’t actually know Lua, but luckily I spent most of my investigation in a...
Note: This is all Python 3 code. Other versions of Python may handle subprocesses and bytearrays differently. A Git bomb is a compact repository that explodes to consume extreme size on disk and in memory. Read more about them in the original git bomb post. This post walks through some code to create them. A full script to create them is...
If you are an adventurous sort (and can handle a potential reboot) I invite you to clone this tiny repo: $ git clone https://github.com/Katee/git-bomb.git Were you able to clone it? Unless you have quite a lot of memory (both RAM and storage) git was killed, ran out of memory, or you had to reboot. Why is this? It is a perfectly formed repo made...
This is a quick follow-up to Weird Python Integers. While writing that post, I saw some Python behaviour I didn’t understand. Then I read some comments by kmill and squeaky-clean in response to my original post, and now I can explain Python’s behaviour. If you don’t know about the “small integers” table in Python, I recommend reading the original...
Note: all of this code was run on my machine using Python 3.6.1. Not everything will work the same if you test using Python 2. >>> a = 42 >>> b = 42 >>> a is b True >>> a = 316 >>> b = 316 >>> a is b False That is suprising! It turns out that all “small integers” with the same value point to the same memory. We can use the Python built-in...