BBC BASIC for Windows
Programming >> BBC BASIC language >> DIfference between dec and hex
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1369679679

DIfference between dec and hex
Post by Matt on May 27th, 2013, 6:34pm

Hi,

Just discovered there is around a 20% increase in speed if the numerics are set in hex format rather than decimal.

Is this due to an increase in calculation steps to convert dec to binary over hex to binary?

Matt

PS No apparent increase in speed when using binary notation.
Re: DIfference between dec and hex
Post by admin on May 27th, 2013, 8:55pm

on May 27th, 2013, 6:34pm, Matt wrote:
Is this due to an increase in calculation steps to convert dec to binary over hex to binary?

That hex constants are faster than decimal constants is well-known, and libraries (in particular) are often written with that in mind. I know, for example, that David Williams' GFXLIB uses hex constants extensively.

I would argue that the reason why hex is faster is of no relevance whatever; I do not discuss the internal implementation of BB4W in that kind of detail.

Richard.