I am nothing, no one, nobody, no more

Get out of life alive le blog de SnippyHolloW.

Bits of talks / mailings

David Lang dans “pourquoi les goto ce n’est pas si mal” (comp linux kernel) pour mutualiser les points de sortie (error handling par ex.), blablabla classique, mais gain de perfs intéressant : defauts de caches !

> I’ve only compiled (and haven’t tested this code), but it should be much
> faster than the original code. Why? Because we’re eliminating an extra
> “jump” in several places in the code every time open would be called.
> Yes, it’s more code, so the kernel is a little bigger, but it should be
> faster at the same time, and memory should be less of an issue nowadays.

Rob, one thing you may not have noticed since you haven’t been following
the list for a while is that with the current generation of computers size

frequently translates directly into speed and a lot of the time honored
performance tricks that trade size for fewer commands executed end up
being losses.

this can be seen by compiling code with -O2 and with -Os and frequently
the -Os will actually be faster.

This is becouse not all memory is equal, main memory is very slow compared
to the CPU cache, so code that is slightly larger can cause more cache
misses and therefor be slower, even if significantly fewer commands are

in addition frequently the effect isn’t direct (i.e. no noticable
difference on the code you are changing, but instead the change makes
other code slower as it gets evicted from the cache)

unfortunantly while this effect is known the rules of when to optimize for
space and when to optimize for fewer cpu cycles for code execution are not
clear and vary from CPU to CPU frequently within variations of the same

if you google for -Os you should find one of the several discussions on
the list in the last year on the subject.

David Lang