I may be an AI
I may be an AI
Posted Jan 5, 2025 18:40 UTC (Sun) by NYKevin (subscriber, #129325)In reply to: I may be an AI by SLi
Parent article: Some things to expect in 2025
One day, I had an epiphany, and restructured it so that the loops were nested differently and we iterated in a different overall order. This literally cut the execution time in half. Subsequently, I was entirely unable to explain how I saved that much performance with such a trivial refactor. It was in Python, with lots of indirection and hash map lookups, so no, this was not a simple case of cache locality. I think it probably involved early returns and avoiding some redundant iterations, but it was a long time ago and I do not remember the details.
The story has a happy ending: We decided to go back to doing X (instead of Y), so the code was deleted, everything went back to reasonable performance, and nobody has to try and understand it anymore. Y was a dumb idea in the first place, and we really only did it as a stopgap as part of a tech migration, so we're probably not going to try and do it again.
