old habits are hard to break
Mark Wilcox
m_p_wilcox at yahoo.co.uk
Fri Jun 21 05:33:35 EDT 2013
Richmond wrote:
> Well that is rather the same as my being extremely mean when removing
> the core of a green pepper,
> cutting as near to the stem as possible, because at one time in my life
> I was really living on the edge,
> financially (when I was in the USA); while now I can both afoord lots of
> green peppers and live in
> a country where they are super abundant.
It's not exactly the same though. With a physical thing like a green pepper, cutting nearer the stem will always get you more to eat. Micro-optimisations to code are dependent on assumptions about underlying compilers/interpreters and hardware and so generally best avoided until required. A good example from this thread is having four different versions of the same function with tiny variations at the beginning. One of the key bottlenecks in a modern device (desktop or mobile) is the speed of the RAM vs the speed of the processor; if your whole program doesn't fit in the CPU caches then splitting out function variants can actually make things slower, due to the need to fetch a different variant from RAM (or even disk or flash memory) vs having a single longer version that remains in cache. Combine that with the fact that you then have to maintain multiple versions of the same code and we have a good example why "premature optimization is the root of
all evil" (Donald Knuth).
Most people use very high level languages like LiveCode to optimise for code clarity, simplicity and readability - certainly not performance.
Maybe the old habits are worth the effort required to break them?
Mark
More information about the use-livecode
mailing list