Re:Rob Pike: Simplicity Is Complicated [video]
by tbrownaw on Thursday December 03, 2015 @09:30PM
(#10674214)
Not really... the wasted time is still all malloc() / realloc() / whatever under array.push(), and a half-decent callgraph profiler will catch that. array.push() will score far higher than it ought to, and the bulk of its time will be the reallocation.
Source: I've used oprofile, and later perf, to hunt exactly this kind of performance bug.
.
Of course, fixing a pervasive issue like that is much more tedious than just finding it. :-(
Obviously, this kind of thing isn't a magic bullet, but in general I'd say the key for any kind of program is to express your intent at the highest level possible. This benefits both optimization and human readers! (That obviously means that the programming language must support such abstraction in a non-leaky way.)
[1] Which would show up prominently on a profile.