Hacker News new | ask | show | jobs
by 04091948 2268 days ago
Imagine that the intern didn't dare to ask such questions.

a - he could've gone out thinking that performance doesn't matter. but it certainly does in a piece of code being used daily by thousands of devs.

b - he could've thought that the simple implementation is faster but missed the fact that skip is implemented in assembly.

c - he could've realized both but missed the why.

and these failure scenarios are likely to happen because this is an intern we're speaking about.

One or two tricks up your sleeve do not matter but repeat this a 100 times which one do you think would be a better programmer?

I think the willingness to challenge authority figures and to be (often) proven wrong and to learn from it is an essential part of becoming better.

Maybe Tim was understanding because he himself challenged people older than him and in-process learned form them.

Advice like "don't reinvent the wheel", "avoid premature optimization", "write boring code" promote exploitation. which is the optimal strategy for older agents.

but for newer agents, a higher level of exploration is needed otherwise they would converge into a suboptimal strategy

1 comments

> he could've thought that the simple implementation is faster but missed the fact that skip is implemented in assembly

It’s not; the compiler is just fairly decent at transforming string manipulation routines.

>As Tim explained to me, first off, the reason why VB does this seemingly bizarre “find the first character match, then check if query is a prefix of source” logic is because the skipto method is not written in the naive fashion that I showed here. The skipto method is a single x86 machine instruction.

oh my bad then, from this text it sounded like it was written in assembly.