Computer Chess Club Archives


Search

Terms

Messages

Subject: Is the register keyword really useful?

Author: Pham Minh Tri

Date: 19:40:50 10/30/00


I see that many programs (like GNU, Crafty) use the register keyword too many -
for almost all integer valuables. This keyword indicates the CPU try to load a
valuable into a register, if posible, and hope that program may run little
quicker.

However, in my view and in the PC machine, it is hopeless or harmful. The number
of registers is very small, and the number of available ones is smaller, and the
number of integer valuables at one time is usually several bigger than them. As
a result, instead of doing something directly in the memory of a valuable, the
CPU has to load it into a register to do this work then store it into memory for
making the register be available for the next command. It turns out, many extra
instructions of loading and storing will make program little slower.

I know this difference is very small and almost can not be measured (and some
compilers like Visual C ignore this keyword) so people could program without
concerning about it.

Pham



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.