Optimization suggestion

Everything else that doesn't fall into one of the other PB categories.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

pdwyer wrote:Interestingly I get much closer results when I swap the position of the functions around.
Ah, I'm not the onliest one noticing this problem...
This occured already at other performance tests on my machine, too...
In some cases, the first loop was always a bit slowier than the following loops.

However, the inaccuracy with ElapsedMilliseconds() is IMHO not significant, if the difference is big enough:
(141-16)-(62+16) = 47 ms
47 is still indicates that the second loops is faster, even if ElapsedMilliseconds() misses the actual time by 16 ms.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

true, it will skew a % figure though. I just made the 3 a 10 to make it a little clearer
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

I don't use C so then i have nothing related to C installed in my pcs.
But Can someone please tell us how the hell does it the best C/C++ compiler on the world, or for example MS VC++ :?: :?:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Gcc uses the mov variant.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Trond wrote:Gcc uses the mov variant.
Mmmhhh... yes,
but i guess Gcc is far to be the best or even between the bests... :?
Thinking twice, take in account that the times you plainly assign a variable to another one is insignificant compared to the times you assign a expression to a variable in any piece of code or in any big app.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Makes no difference whatsoever on my machine.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
gnasen
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 24, 2008 12:21 am

Post by gnasen »

nearly every time the same result

109 vs 109
pb 5.11
Post Reply