<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Using a 64bit CPU...' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Using a 64bit CPU...' posted on the 'Delphi and Kylix' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 09:12:14 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 09:12:14 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Using a 64bit CPU...</title>
      <link>http://www.programmersheaven.com/mb/delphikylix/338945/338945/using-a-64bit-cpu/</link>
      <description>I wrote a Delphi program in which we need to access to memory a lot.But unfortunately, it is very time consuming on my Pentium 4 (2.8GHz 512MB )  To speed up it someone advices me to a 64bit CPU. But do you agree with them? Thanks&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/delphikylix/338945/338945/using-a-64bit-cpu/</guid>
      <pubDate>Sat, 10 Jun 2006 22:51:48 -0700</pubDate>
      <category>Delphi and Kylix</category>
    </item>
    <item>
      <title>Re: Using a 64bit CPU...</title>
      <link>http://www.programmersheaven.com/mb/delphikylix/338945/338946/re-using-a-64bit-cpu/#338946</link>
      <description>: I wrote a Delphi program in which we need to access to memory a lot.But unfortunately, it is very time consuming on my Pentium 4 (2.8GHz 512MB )  To speed up it someone advices me to a 64bit CPU. But do you agree with them? Thanks&lt;br /&gt;
: &lt;br /&gt;
That won't help, because your program is probably getting slow due to the latency (http://en.wikipedia.org/wiki/RAM_latency) to get its data from the memory. The best way to tackly this problem is to design another algorithm, which doesn't need to access the memory so much.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/delphikylix/338945/338946/re-using-a-64bit-cpu/#338946</guid>
      <pubDate>Sat, 10 Jun 2006 23:16:05 -0700</pubDate>
      <category>Delphi and Kylix</category>
    </item>
    <item>
      <title>Re: Using a 64bit CPU...</title>
      <link>http://www.programmersheaven.com/mb/delphikylix/338945/338950/re-using-a-64bit-cpu/#338950</link>
      <description>: : I wrote a Delphi program in which we need to access to memory a lot.But unfortunately, it is very time consuming on my Pentium 4 (2.8GHz 512MB )  To speed up it someone advices me to a 64bit CPU. But do you agree with them? Thanks&lt;br /&gt;
: : &lt;br /&gt;
: That won't help, because your program is probably getting slow due to the latency (http://en.wikipedia.org/wiki/RAM_latency) to get its data from the memory. The best way to tackly this problem is to design another algorithm, which doesn't need to access the memory so much.&lt;br /&gt;
: &lt;br /&gt;
Thanks. You are right. But please consider the following codes:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
//Code #1
var M,N:array of array of byte;
 T:integer;
 ...
begin
 SetLength(M,640,640);
 SetLength(N,640,640);

 //Fill each array with some data
 FillMatrix(M);
 FillMatrix(N);

 T:=Gettickcount;
 //Do some operations with M
  Operate(M);
 
//Do some operations with N
  Operate(N);
 
  showmessage(inttostr(Gettickcount-T)); // T=800 msec
end;
&lt;/pre&gt;&lt;br /&gt;
In the above code, the whole process takes about 800msec. Intresting is that if I change Operate(N) to Operate(M), the whole process takes about 650msec !!! In his case we have the following code:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
//Code #1
var M,N:array of array of byte;
 T:integer;
 ...
begin
 SetLength(M,640,640);
 SetLength(N,640,640);

 //Fill each array with some data
 FillMatrix(M);
 FillMatrix(N);

 T:=Gettickcount;
 //Do some operations with M
  Operate(M);
 
//Do some operations with M
  Operate(M);
 
  showmessage(inttostr(Gettickcount-T)); // T=650 msec
end;
&lt;/pre&gt;&lt;br /&gt;
But I am wondering why this happen?!! Do you know its reason? I have another question too. Please consider the following codes:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
 //code 3
 var i,t:integer;
 ...
 t:=i;
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
 //code 4
 var t:integer;
 M:array[0..20] of array[0..20] of integer;
 ...
 t:=M[10,10];
&lt;/pre&gt;&lt;br /&gt;
Which one is faster? (Code 3 or Code 4)&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/delphikylix/338945/338950/re-using-a-64bit-cpu/#338950</guid>
      <pubDate>Sun, 11 Jun 2006 02:41:04 -0700</pubDate>
      <category>Delphi and Kylix</category>
    </item>
    <item>
      <title>Re: Using a 64bit CPU...</title>
      <link>http://www.programmersheaven.com/mb/delphikylix/338945/338951/re-using-a-64bit-cpu/#338951</link>
      <description>: : : I wrote a Delphi program in which we need to access to memory a lot.But unfortunately, it is very time consuming on my Pentium 4 (2.8GHz 512MB )  To speed up it someone advices me to a 64bit CPU. But do you agree with them? Thanks&lt;br /&gt;
: : : &lt;br /&gt;
: : That won't help, because your program is probably getting slow due to the latency (http://en.wikipedia.org/wiki/RAM_latency) to get its data from the memory. The best way to tackly this problem is to design another algorithm, which doesn't need to access the memory so much.&lt;br /&gt;
: : &lt;br /&gt;
: Thanks. You are right. But please consider the following codes:&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
: //Code #1
: var M,N:array of array of byte;
:  T:integer;
:  ...
: begin
:  SetLength(M,640,640);
:  SetLength(N,640,640);
: 
:  //Fill each array with some data
:  FillMatrix(M);
:  FillMatrix(N);
: 
:  T:=Gettickcount;
:  //Do some operations with M
:   Operate(M);
:  
: //Do some operations with N
:   Operate(N);
:  
:   showmessage(inttostr(Gettickcount-T)); // T=800 msec
: end;
: &lt;/pre&gt;&lt;br /&gt;
: In the above code, the whole process takes about 800msec. Intresting is that if I change Operate(N) to Operate(M), the whole process takes about 650msec !!! In his case we have the following code:&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
: //Code #1
: var M,N:array of array of byte;
:  T:integer;
:  ...
: begin
:  SetLength(M,640,640);
:  SetLength(N,640,640);
: 
:  //Fill each array with some data
:  FillMatrix(M);
:  FillMatrix(N);
: 
:  T:=Gettickcount;
:  //Do some operations with M
:   Operate(M);
:  
: //Do some operations with M
:   Operate(M);
:  
:   showmessage(inttostr(Gettickcount-T)); // T=650 msec
: end;
: &lt;/pre&gt;&lt;br /&gt;
: But I am wondering why this happen?!! Do you know its reason? I have another question too. Please consider the following codes:&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
:  //code 3
:  var i,t:integer;
:  ...
:  t:=i;
: &lt;/pre&gt;&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
:  //code 4
:  var t:integer;
:  M:array[0..20] of array[0..20] of integer;
:  ...
:  t:=M[10,10];
: &lt;/pre&gt;&lt;br /&gt;
: Which one is faster? (Code 3 or Code 4)&lt;br /&gt;
: &lt;br /&gt;
I don't know the answer to the first question, but it might have to do with the L1 cache or with the optimalization of the compiler.&lt;br /&gt;
The answer to your second question is: Code 3. Because in Code 4 the compiler needs to calculate the memory location based on the indexes. The assignment itself is equally fast.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/delphikylix/338945/338951/re-using-a-64bit-cpu/#338951</guid>
      <pubDate>Sun, 11 Jun 2006 03:35:27 -0700</pubDate>
      <category>Delphi and Kylix</category>
    </item>
    <item>
      <title>Re: Using a 64bit CPU...</title>
      <link>http://www.programmersheaven.com/mb/delphikylix/338945/338956/re-using-a-64bit-cpu/#338956</link>
      <description>: : : : I wrote a Delphi program in which we need to access to memory a lot.But unfortunately, it is very time consuming on my Pentium 4 (2.8GHz 512MB )  To speed up it someone advices me to a 64bit CPU. But do you agree with them? Thanks&lt;br /&gt;
: : : : &lt;br /&gt;
: : : That won't help, because your program is probably getting slow due to the latency (http://en.wikipedia.org/wiki/RAM_latency) to get its data from the memory. The best way to tackly this problem is to design another algorithm, which doesn't need to access the memory so much.&lt;br /&gt;
: : : &lt;br /&gt;
: : Thanks. You are right. But please consider the following codes:&lt;br /&gt;
: : &lt;pre class="sourcecode"&gt;
: : //Code #1
: : var M,N:array of array of byte;
: :  T:integer;
: :  ...
: : begin
: :  SetLength(M,640,640);
: :  SetLength(N,640,640);
: : 
: :  //Fill each array with some data
: :  FillMatrix(M);
: :  FillMatrix(N);
: : 
: :  T:=Gettickcount;
: :  //Do some operations with M
: :   Operate(M);
: :  
: : //Do some operations with N
: :   Operate(N);
: :  
: :   showmessage(inttostr(Gettickcount-T)); // T=800 msec
: : end;
: : &lt;/pre&gt;&lt;br /&gt;
: : In the above code, the whole process takes about 800msec. Intresting is that if I change Operate(N) to Operate(M), the whole process takes about 650msec !!! In his case we have the following code:&lt;br /&gt;
&lt;br /&gt;
It's becouse of the cache. The computer transparently loads ram memmory into cache that's a lot faster, but smaller than ram.&lt;br /&gt;
&lt;br /&gt;
I would recomend optimising operate.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/delphikylix/338945/338956/re-using-a-64bit-cpu/#338956</guid>
      <pubDate>Sun, 11 Jun 2006 06:55:48 -0700</pubDate>
      <category>Delphi and Kylix</category>
    </item>
  </channel>
</rss>