Re:Rob Pike's Rules of Programming (1989)
by smegel on Saturday September 16, 2017 @05:13PM
(#15266793)
Why are you even asking the question if profiling hasn't determined a performance problem in that bit of code?
Re:Rob Pike's Rules of Programming (1989)
by khedoros1 on Saturday September 16, 2017 @07:45PM
(#15267393)
I'm considering cases where looping over a list mean using a simpler algorithm than whatever's provided by "Get", applying rules #3+#4, after determining that "Get" is a bottleneck.
Re:Rob Pike's Rules of Programming (1989)
by parenthephobia on Saturday September 16, 2017 @06:59PM
(#15267217)
Is this really an explanation of why manually iterating over a list is simpler than just calling a method?
Get is simpler precisely because it hides the complexity.
> Or maybe "Why aren't you using your language's library methods to loop over that list?"
What makes those methods not subject to the "hiding complexity" objection?
Re:Rob Pike's Rules of Programming (1989)
by khedoros1 on Saturday September 16, 2017 @07:43PM
(#15267382)
It's an ill-considered stream of consciousness where I wasn't clearly separating "simplicity of interface" from "simplicity of implementation".
Part of what I was going for is that a clean interface might hide a complex implementation. If you've followed rule 1 and see that "Get" is a bottleneck, it makes sense to apply rules 3+4, and see if there isn't a simpler implementation than the one provided by "Get".
So the next question is "What's the implementation of the Get(key) method?" Or maybe "Why aren't you using your language's library methods to loop over that list?"