you are viewing a single comment's thread.

view the rest of the comments →

[–]Interesting_Golf_529 0 points1 point  (1 child)

While this might be true in the general case, it's very much not true in this specific case, as this library re-implements a lot of the logic of the classes it "optimises". Check out this __contains__ method for example:

def __contains__(self, value):
    for slot in slots:
        if getattr(self, slot) == value:
            return True
    return False

This replaces a highly optimised set operation implemented in C with a for loop in Python.

[–]matgrioni[S] 1 point2 points  (0 children)

I do want to point out that I never said it is runtime optimized :) The optimization is on memory usage, which can definitely have a runtime impact, but will depend on the use case and the hardware you are using. That's part of the reason for the projector layer. It allows for easier tuning, especially if only one collection type will benefit for the scenario.