xsharp.eu • Session material: Differences between VO and X# - Page 3
Page 3 of 3

Session material: Differences between VO and X#

Posted: Mon Jul 02, 2018 1:10 pm
by FFF
Wolfgang,
not sure if such tests yield useful results. Lot's of things may interfere.

Copying from you, i built

Code: Select all

FUNCTION Start() AS VOID
LOCAL nReal1 := 0 AS INT
LOCAL nReal2 := 0 AS INT                                              
LOCAL nI := 0 AS INT                                              
LOCAL nLen := 100000000 AS INT                                              

LOCAL nStart := Seconds() AS   REAL8
FOR nI := 1 UPTO nLen
  nReal2 := nReal1 + nReal2
NEXT            
Console.WriteLine( "Adding numbers with " + NTrim( nLen ) + " iterations took " + NTrim( Seconds() - nStart ) + " seconds" )

RETURN
using a Basic X# sample with added references to the X#.core and .VO
Result with 1M iterations was 0,02 sec.
With 10M 0,05
with 100M 0,27 (!)
with 1G 2,17

The latter with all Real8 all over the place 2,66
The latter with all decimals all over the place 47,16 ;-)
I would think about swapping to decimal if number crunching is "on"

Karl

Session material: Differences between VO and X#

Posted: Mon Jul 02, 2018 1:12 pm
by wriedmann
Hi Johan,

I may be wrong, but AFAIK the JIT compiled image is stored in a sort of cache.

Wolfgang

Session material: Differences between VO and X#

Posted: Mon Jul 02, 2018 1:13 pm
by FFF
lumberjack wrote:In the above example, the native HelloWorld will be faster than the .net version due to the penalty of the JIT compiler. It needs to compile 1000 times.
Sure about this? IIRC, moons ago MS optimized the JIT to cache results and recognize that no change to the code was done. But maybe i'm dreaming ;)

Session material: Differences between VO and X#

Posted: Mon Jul 02, 2018 2:41 pm
by ic2
Hello Johan,

[quote="In this scenario, it should be a close call internally, since both are now actually "native". My bet is though that the .net version will outperform the native application due to better resource management/optimization.
[/quote]

That makes sense. For many programs the couple of seconds waiting time is not a problem. However, it still feels like a bit of a nuisance when I start e.g. Word 2016 and it takes 3 seconds before I can do anything against 0,2 seconds for Word 2003; one of the reasons I always start Word 2003.

A few years back, I was invited by Frank Maraite to work together to Transport our dbf viewer (DBV) to Vulcan. Frank had already gained a lot of knowledge about the process so he managed to get it working within an afternoon. A couple of functions worked faster, a much smaller number slower and some worked way faster. However, we kept using the VO version because during developing or problem solving I type (DBV databasename) from a DOS prompt dozens of time and also here I can start looking at the data instantly while the Vulcan version took 2-3 seconds to show.

But we have just decided that this program should go to X# and be modernized, as the VO browser acts erratic and there's a lot more to improve. So unfortunately I will add a few hours waiting time a year but hopefully a modernized .Net program is worth it.

Dick