Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use marshal + sha1 to track seen objects
Does this look like an ugly commit? You're quite wrong. This is a beautiful commit. This commit: 1. Vastly speeds up Hypothesis 2. Vastly reduces Hypothesis's memory usage 3. Paves the way for throwing away some utterly terrible code. Tracker previously used HashItAnyway, which uses extmethods for equality and hashing to let us put arbitrary objects into a dict. This did a lot of hashing and equality logic in pure python and thus was deathly slow, even when the hashing logic was good (which it often wasn't). Additionally, this meant we were keeping around a bunch of complex Python objects in memory which takes up a large amount of space. Because we only need to track templates, which both typically are and can easily be enforced to be simple data types, this takes advantage of the stability of the marshal format for tracking. We then sha1 the results (I'm not concerned about collisions because this is not an adversarial situation) and get to instead track a digest that uses less memory than a simple python object, let alone the complex data we were previously tracking. In short, this commit is pretty great. Give it a hug.
- Loading branch information
a4921b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏆
a4921b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no :hug: 😞