Faster memory copy (optimized for AMD)

Share your advanced PureBasic knowledge/code with the community.
Max.²
Enthusiast
Enthusiast
Posts: 175
Joined: Wed Jul 28, 2004 8:38 am

Post by Max.² »

Bonne_den_kule wrote:Looks like it is big difference between a AthlonXp 2400 and 2500. I have only 512MB, cheap memory. Here is my results.
Guess it mainly depends on the frontside bus and the chipset. XP 2500 are generally FSB 333, while XP 2400 I think were available at 266 and 333.

I got an XP 2400/266 and therefor was a bit surprised by traumatic's results, as XP 1600 always are 266 too. Memory is pretty fast for my machine (CL2) so probably the OS and the chipset jump in.
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

Max.² wrote:
Bonne_den_kule wrote:Looks like it is big difference between a AthlonXp 2400 and 2500. I have only 512MB, cheap memory. Here is my results.
Guess it mainly depends on the frontside bus and the chipset. XP 2500 are generally FSB 333, while XP 2400 I think were available at 266 and 333.

I got an XP 2400/266 and therefor was a bit surprised by traumatic's results, as XP 1600 always are 266 too. Memory is pretty fast for my machine (CL2) so probably the OS and the chipset jump in.
I am using 333 fsb (166hz). but 2700 512 mb ram (one block).
Last edited by Bonne_den_kule on Mon Nov 29, 2004 3:26 pm, edited 2 times in total.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Excellent work 8)

BTW: I don't want to offend anybody, specially not Fred - HI FRED - but shouldn't stuff like that be covered by the PureBasic compiler :?:
Under 'compiler options', in the editor, it suggests that it's able to OPTIMIZE for ALL CPU's, MMX, SSE, SSE2 and 3DNOW, but actually it seems it doesn't 8O

:?
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Forgot to post my results:
  • ---------------------------
    Test Results 1st run:
    ---------------------------
    --- 64 MB tranfer test ---
    AMD Function : 281
    Pure Function : 4606
    AMD Function is 16 times faster.

    --- 1 MB tranfer test ---
    AMD Function : 2464
    Pure Function : 61278
    AMD Function is 24 times faster.

    --- 100kb tranfer test ---
    AMD Function : 30
    Pure Function : 5538
    AMD Function is 184 times faster.
Impressive 8O
  • ---------------------------
    Test Results 2nd run:
    ---------------------------
    --- 64 MB tranfer test ---
    AMD Function : 251
    Pure Function : 3395
    AMD Function is 13 times faster.

    --- 1 MB tranfer test ---
    AMD Function : 2473
    Pure Function : 55310
    AMD Function is 22 times faster.

    --- 100kb tranfer test ---
    AMD Function : 20
    Pure Function : 5087
    AMD Function is 254 times faster.
Even More Impressive 8O

SONY Notebook Duron950, 256mb ram, WinXP
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

That's indeed impressive results. As FSW, I will add this optimization to the CopyMemory() command, so it can take advantage of new CPU trough the compiler switch.
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Hi Fred.
It's great to see someone like you taking note of tests we users do and do something about it. More developers should be alot more like you ;)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Fred wrote:That's indeed impressive results. As FSW, I will add this optimization to the CopyMemory() command, so it can take advantage of new CPU trough the compiler switch.
8)
Thanks
coma
Enthusiast
Enthusiast
Posts: 164
Joined: Fri Aug 15, 2003 3:46 am
Location: Canada

Post by coma »

Excellent El_Choni, if you have any other tips like this..... :)
akee
Enthusiast
Enthusiast
Posts: 496
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Post by akee »

GeoTrail wrote:Hi Fred.
It's great to see someone like you taking note of tests we users do and do something about it. More developers should be alot more like you ;)

That's why PB is a "kick butt" translator. I hardly click on my Visual Studio icon these days... :wink:
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

WOAH...
isn't there anything that that some one can't opimaize!
~Dreglor
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Fred wrote:That's indeed impressive results. As FSW, I will add this optimization to the CopyMemory() command, so it can take advantage of new CPU trough the compiler switch.
Hey, nice :D
But don't forget, please :wink:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Froggerprogger
Enthusiast
Enthusiast
Posts: 423
Joined: Fri Apr 25, 2003 5:22 pm
Contact:

Post by Froggerprogger »

Here are results on an Pentium Mobile 2,4GHz 512 DDR:
--- 64 MB tranfer test ---
AMD Function : 200
Pure Function : 3175
AMD Function is 15 times faster.

--- 1 MB tranfer test ---
AMD Function : 2814
Pure Function : 53356
AMD Function is 18 times faster.

--- 100kb tranfer test ---
AMD Function : 40
Pure Function : 581
AMD Function is 14 times faster.
Cool!
2814ms instead of 53356ms !
%1>>1+1*1/1-1!1|1&1<<$1=1
newbie
Enthusiast
Enthusiast
Posts: 296
Joined: Tue Jul 29, 2003 5:47 pm
Location: FRANCE
Contact:

Post by newbie »

AMD Athlon XP 2000+ (+DDR 333Mhz)

Image

hooah :D

EDIT : I have a question :
Does that optimization means that it is by now faster to write :

Code: Select all

var1.s = "toto"
var2.s = ""

CopyMemoryAMD(@var1, @var2, 4)
than to use the normal way :

Code: Select all

var2 = var1
??
- Registered PB user -

Using PB 4.00
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

BTW, Fred, if you plan to add this routine to PB, remember to include the "align" directives I had to comment in the code due to the fact that "align" is redefined by PB to be used only in the data section.

Regards,
El_Choni
Andras
User
User
Posts: 34
Joined: Wed Oct 27, 2004 6:58 am
Location: Germany

Post by Andras »

AMD-Athlon XP 2400+


---------------------------
Test Results
---------------------------
--- 64 MB tranfer test ---

AMD Function : 94

Pure Function : 1734

AMD Function is 18 times faster.



--- 1 MB tranfer test ---

AMD Function : 578

Pure Function : 27156

AMD Function is 46 times faster.



--- 100kb tranfer test ---

AMD Function : 16

Pure Function : 406

AMD Function is 25 times faster.
Undank ist der Welten Lohn
Post Reply