Skip to content

Conversation

kezabelle
Copy link
Contributor

Ticket is 33474, opening PR to get CI sign-off before it's even considered for accepting.

According to pympler, this changes the size of a simple instantiated Variable from 592 to 216, and a FilterExpression containing the same Variable from 1000 to 368 using python3.10. I've not observed any particular difference in runtime performance, though it would be ideal if anyone else could demonstrate there is one, better or worse.

Note that in a production environment where the cached template loaders are ordinarily used, this is just going to be reducing the high-water-mark for keeping those around in memory.

@kezabelle
Copy link
Contributor Author

@smithdc1 This is (a part of) the idea you provided on the other PR in case you wanted to take a gander and shoulder some of the blame ;) as I alluded, same oeuvre.

@felixxm felixxm self-assigned this Feb 2, 2022
@felixxm
Copy link
Member

felixxm commented Feb 2, 2022

@kezabelle Thanks 👍

@felixxm felixxm changed the title Fixed #33474 -- Added __slots__ definitions to Variable and FilterExpression Fixed #33474 -- Added __slots__ to Variable and FilterExpression. Feb 2, 2022
@felixxm felixxm merged commit 84418ba into django:main Feb 2, 2022
@smithdc1
Copy link
Member

smithdc1 commented Feb 2, 2022

Looks like @felixxm is way ahead of me here 👍.

This makes sense to me, looks good. I had a browse on GitHub and couldn't see any cases of folk doing things which this change would cause a breaking change from them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants