Session material: Differences between VO and X#

This forum is meant for anything you would like to share with other visitors
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Session material: Differences between VO and X#

Post 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
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Session material: Differences between VO and X#

Post by wriedmann »

Hi Johan,

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

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Session material: Differences between VO and X#

Post 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 ;)
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Session material: Differences between VO and X#

Post 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
Post Reply