Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: speed question about programs?

Author: Angrim

Date: 11:25:53 05/26/00

Go up one level in this thread


On May 26, 2000 at 10:25:39, blass uri wrote:

>I understand that searching for the value of a varaible can take more time if
>the variable is not in the CPU(not register variable).
>
>I have some questions
>
>1)Is searching for the value of a register variable takes the same time in case
>of more variables when there are more variables in the CPU.

No, the time required to access a register is not affected by how many
registers are being used by the current process.

>2)Is searching for the value of a variable takes more time in case of more
>variables if the variable is not in the CPU.

Yes, if you have so many variables in memory that they do not all fit
into the CPU cache, then it can take longer to access them.

>3)How many register variables can be saved in the registers of the CPU

Depends on the CPU, 6-32 is common.

>4)How much faster is using register variables relative to using not register
>variables?

Much. a register access is at most 1 clock cycle, access to main memory can
take a dozen or more cycles if you get a cache miss.

>My logic say that searching for the value of the variable should take more time
>in every case when there are more variables because searching for a word in a
>big dictionary takes more time than searching for a word in a small dictionary
>but I do not know if computers search in a "dictionary" for variables or use
>another method.

No, it is not like a dictionary.  The location of each variable is stored
in the program so that no searching is required.

>I understand that the reply to questions 3 and 4 may be dependent on the
>hardware
>
>Uri

Note that modern compilers optimize which variables go into registers
without any help from the user, so knowing this stuff is less useful than
it was a decade ago.

Angrim



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.