3 ms·
Cowards. Respond if you have problems. I’ve just gone through removing “memoization” from two parts of our code that were difficult to understand even without
by hinkley 3y ago
Cowards. Respond if you have problems.
I’ve just gone through removing “memoization” from two parts of our code that were difficult to understand even without the caching layer. The reason I did the second one is because the first one went so well I wanted to see if it was a fluke.
In doing the first, what I did was replace depth first execution with a tree scan. At the end I had a set of actions that needed to happen, and why. Essentially a plan for the execution. That’s a great spot for a breakpoint if the code or a test are failing, but it also yields you a set with all of the duplicates removed, instead of a graph. And in this case the number of data operations to combine all of the data is n+1 instead of > nlog(n) based on the number of duplicates. It also pointed out other optimizations that were possible.
In the second case it also surfaces a potential ordering problem, and the added wrinkle was that some warning messages were being repeated, quite confusing to other developers. Those could be reduced from eight to three.
In both cases memory usage was reduced (and in the one case the code was a bottleneck for starting short lived processes) because you don’t cache anything that is used once. There is no clever trick you need to work out. It just works, and the mechanism is perfectly readable and reason-able.
- nequo 3y agoYour HN karma is nearly 33 thousand. Why get so aggressive about a few down votes? I was among those who down voted your earlier comment, and I did so because of the talk about knocking heads with a baseball bat.
- hinkley 3y agoThis account is over 3000 days old so that’s less than eleven imaginary internet points per day. Which is really how it mostly goes. Three points here, six points there. Nothing much for a couple of days, then something up or down. It’s not the points it’s the conversation. One of the few times this year I scored highly, I said virtually the same thing in two parts of the same post. Nothing sarcastic, no dark humor, something like +40 points and responses for one, no responses and oblivion for the other. I only know they former because the latter made me curious. Popularity is weird, not that I’m probably telling you anything new. There are some ideas that are only popular here for a certain crowd, and if they see it first you’re good, if they don’t it’s either gone, or you come back a few hours later to see you’ve swung from -2 to +5. It’s a nice vindication but your flow is gone and so I never feel like those conversations get as far. Maybe that person is a kook, or maybe you’ve had a narrow experience. Or they have. Maybe if you talk about it you’ll learn which. One of those topics, based on previous experience (here, elsewhere, and I’m person”, seems to be, “DP is much more than caching”. Anyway, thanks for replying.