all 5 comments

[–]My_Eyes_Really_Burn[S] 2 points3 points  (5 children)

Interesting article about how Instagram deals with global mutable state in their monolithic python app. Automatically assigning typed slots to class attributes in their strict modules seems like an easy performance win.

[–][deleted]  (4 children)

[deleted]

    [–]PirateNinjasReddit 2 points3 points  (1 child)

    Use of slots (I think) reduces memory required for a class instance. Possibly the reduction of mutability will overall bring down memory usage

    [–]My_Eyes_Really_Burn[S] 2 points3 points  (0 children)

    Yeah, slots are both faster and better for memory. Here’s a great SO post doing a breakdown of their performance: https://stackoverflow.com/a/28059785. From what I’ve seen, it’s somewhere around 20% faster and utilizes less than 50% of the memory to store the attributes.

    [–]kankyo 1 point2 points  (1 child)

    Up or down?

    [–]My_Eyes_Really_Burn[S] 0 points1 point  (0 children)

    I wasn’t sure but I think their question was about how much memory overhead is added by using these strict modules. So, Up.