Opened 2 hours ago
Last modified 7 minutes ago
#37125 new Cleanup/optimization
Use __new__ to sanitize TaskResult instead of __post_init__ to half memory usage
| Reported by: | Johannes Maron | Owned by: | |
|---|---|---|---|
| Component: | Tasks | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Johannes Maron | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
One discovery was the memory overhead created by __post_init__ which doubles the working memory when compared to a factory method.
A __new__ method is what I used in the benchmark and what I would consider the most Pythonic way while also maintaining full compatibility.
Note:
See TracTickets
for help on using tickets.
Can you share the benchmark script? I'd like to just eyeball the setup before drawing conclusions.