r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Profiling] Rebol code optimisation and algorithm comparisons.

PeterWood
2-Jun-2010
[428x2]
What initially surprised me was that there did not appear to be a 
significant difference bewteen OS X (native) and XP(VM) with  time-block[now/precise] 
0,05
That certainly doesn't suggest that OS X system calls are faster 
than Windows ones.
Maxim
2-Jun-2010
[430x3]
could be that the motherboard and I/O chips are better integrated 
on OSX which means any access to hardware has less latency.
so... does an XP running on a OSX VM run faster than the same on 
a PC board?  ;-)
(i.e. not using a VM)
PeterWood
2-Jun-2010
[433x2]
I was less surprised that XP(VM) performed time-block [ ] 0,05 about 
1.6 times faster than under OS X (Native) as I suspect that Carl 
is more likely to have better  optimised Rebol on Windows than other 
systems.
Max: As I understand, there is at least a 10 per cent performance 
penalty for running Windows under a VM rather than directly (using 
Bootcamp).
Maxim
2-Jun-2010
[435]
Its also possible that MS compilers are better at optimisation on 
intel CPUs than Apple.
Ladislav
2-Jun-2010
[436x5]
Peter, I obtain the same value when running XP in the VirtualBox:

>> include %timblk.r
== 9.93798449612403E-3
>> time-block [] 0,05
== 7.97957181930542E-9
>> time-block [now/precise] 0,05
== 2.11906433105469E-6
so, the time granularity of XP running in VirtualBox looks smaller, 
than when running natively
funny
PeterWood
2-Jun-2010
[441]
From a quick browse of the Virtual Box User Manual, a VM uses the 
host systems "time stamp counter" by default. There are a number 
of options to change the "guest clock".


It's section 9.10 in the Virtual Box User Manual if you want to take 
a look.
Davide
2-Jun-2010
[442]
>> time-block [now/precise] 0,05
== 2.328125E-6
Gabriele
3-Jun-2010
[443x4]
>> time-block [now/precise] 0,05
== 2.43203125E-5
>> time-block [now/precise] 0,05
== 1.526171875E-5
>> time-block [now/precise] 0,05
== 2.44140625E-5
>> time-block [now/precise] 0,05
== 2.42890625E-5
>> time-block [now/precise] 0,05
== 2.4203125E-5
>> time-block [now/precise] 0,05
== 2.4265625E-5
>> time-block [] 0,05
== 1.11503601074219E-8
>> time-block [] 0,05
== 1.11885070800781E-8
>> time-block [] 0,05
== 1.11618041992188E-8
>> time-block [] 0,05
== 1.12886428833008E-8
Max: scratch your theory, this is Linux running on an iMac 24"
(btw, i guess Linux is doing timezone conversion in the time system 
calls, while osx is not, and that would explain the huge difference 
in speed.)
BrianH
4-Jun-2010
[447]
Steeve, could you submit your CureCode #574 DP function to DevBase? 
Or can I? Good work, and it uses well features introduced to R3 since 
DP was originally written. We would do well to have this function 
:)
Steeve
4-Jun-2010
[448]
As you wish Brianh
Maxim
27-Jan-2011
[449]
some things are stunningly non-obvious when it comes time to optimize 
REBOL


>> a: 1x1 b: 10x10 s: now/precise loop 1000000 [second b - a] difference 
now/precise s
== 0:00:00.5


>> a: 1x1 b: 10x10 s: now/precise loop 1000000 [b/y - a/y] difference 
now/precise s
== 0:00:00.969
Henrik
27-Jan-2011
[450]
so, pair refinements are slow?
Maxim
27-Jan-2011
[451x2]
all path access is slow...but I woudn't have thought that using a 
series function and multiplying both values in the pair would be 
twice as fast!
in my mind it would have been roughly equivalent.
Henrik
27-Jan-2011
[453]
that's very interesting for DRAW blocks. I wonder if R3 has the same 
issue.
Maxim
27-Jan-2011
[454x3]
just tried it... A100

in R3 they *are* roughly equivalent  :-)

in fact in R3 the second version is ~ 10% FASTER  !
so, claims that the path access is faster in R3 seems to be true 
across the board
btw the first version is exaclty the same speed as in R2, on my system.
Steeve
27-Jan-2011
[457x2]
I don't use first, second, third .... anymore in R3.
when I have the choice, indeed
Maxim
27-Jan-2011
[459:last]
yeah, its much easier to read.  I only use first/second in R2 because 
their faster.