it really depends on how good the programmer is... And I was wondering what that actually means.
It means, in this case, that the programmer knows the language s/he works in, and uses the right (fast) idioms to implement the right (fast) algorithms for the job at hand.
How can I tell Bad code from Good Code?
Learn, learn, learn. Practice, practice, practice. For optimization purposes, learn to use a profiler. Read books like Kernighan and Pike's The Practice of Programming or Bentley's Programming Pearls.
The idea of looking into open source code is very good, I learned many of my tricks that way. Contributing to one might be even better; fix bugs and send patches. In my experience, the OpenBSD folks in particular were always ready to review patches; they're also very careful programmers because of their security requirements.