|
|
Log in / Subscribe / Register

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

I distinctly remember writing some code for a system, that was designed to do X, to make it do Y instead of X. It was long and ugly and involved multiple nested loops. It had incredibly poor performance, taking over a minute to do something that ought to finish in seconds.

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.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds