fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Performance comparison X# runtime vs Vulcan runtime

Performance comparison X# runtime vs Vulcan runtime 1 year 1 day ago #5065

  Otto's Avatar Topic Author Otto Offline Posts: 141
Has anyone already any benchmarks? Just curious...

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 1 year 1 day ago #5066

  wriedmann's Avatar wriedmann Away Posts: 1549
Hi Otto,

I have it on my todo list.

I'm planning to compare array creation, size change, sort, find.

Do you have other ideas?

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 1 year 1 day ago #5067

  Otto's Avatar Topic Author Otto Offline Posts: 141
Typical VO/Vulcan language things, using the runtime. But maybe it isn't separable from the compiler sometimes I guess.

* late bound calls
* use of symbols/atoms
* date manipulation

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 1 year 1 day ago #5068

  wriedmann's Avatar wriedmann Away Posts: 1549
Hi Otto,

I will try to put together something and release it with the sources so you or someone other can add more tests.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 1 year 1 day ago #5069

  Chris's Avatar Chris Offline Posts: 1149
Guys,

Just a quick heads up, we did write the runtime with performance in mind, but have not done much optimization on the code yet, first important stuff is to just implement all the required functionality.

This means that in some cases the X# runtime will be faster, but I am sure that in other cases it will be slower, or much slower. But that's just temporarily, it will improve a lot in the coming weeks.

We will also run speed tests, but having said that, any test you do you guys yourselves is greatly appreciated, less work for us to find out in which areas we need to focus regarding speed optimization!

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Last edit: by Chris.

Performance comparison X# runtime vs Vulcan runtime 1 year 15 hours ago #5074

  wriedmann's Avatar wriedmann Away Posts: 1549
Hi,

constructing arrays the X# runtime is much, much faster than the Vulcan runtime.

My test code took 6,49 seconds with the Vulcan runtime and 1,67 seconds with the X# runtime.

This was my sample:
function CheckArrayPerformance() as void
local aArray as array
local aDetail as array
local nI as dword
local nJ as dword
local nLen as dword
local nStart as float
	        
aArray := {}
nLen := 5000
nStart := Seconds()
	
for nI := 1 upto nLen
  aDetail := ArrayNew( int( nLen ) )
    for nJ := 1 upto nLen
      aDetail[nJ]			:= nJ * nI 
    next
    AAdd( aArray, aDetail )
next
	
Console.WriteLine( "Filling the bidimensional test array with " + NTrim( nLen ) + " elements each took " + NTrim( Seconds() - nStart ) + " seconds" )
	
return

Running the test with 10.000 elements failed with both runtimes with a out of memory exception.

Repeating the test with the X# runtime in AnyCPU mode it was slower: 2,23 seconds, but it was able to finish the test also with 10.000 elements.

Very good work!

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5090

  mhsabado's Avatar mhsabado Offline Posts: 4
Hi,
Maybe OT. Running this test under Harbour 64-bit:

5,000 = 1.6s
10,000 = 6.94s
20,000 = 30.76s

Regards,
Mario

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5091

  FFF's Avatar FFF Offline Posts: 571
Got exactly the same for 5k as you, while 10k needed 9,4sec.
@Chris: there's a trap in XIDE: created a new X# core sample, added the x#runtime references, (Core&VO). Platform auto-changed to x86. clicking on anyCpu (or x64) works, compiles and runs, but silently switches back to x86!

Karl

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5092

  wriedmann's Avatar wriedmann Away Posts: 1549
I have tried that now with VO 2.8.

With 5.000 elements and the addition of SetMaxDynSize( 0x8000000 ) it took very long until it terminated with a "dynamic memory low" error.
With 2.500 elements it took 27,2 seconds.

My conclusion is that the memory managment in .NET is much, much better in VO, and large VO applications with heavy array use may perform better in X# than in Visual Objects.

Another thing to try will be the macro compiler using AScan().. There I would expect VO to be faster.

Of course the values of Harbour are not off-topic, but they are interesting to see what a machine code program can do better than a .NET based software.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5093

  lumberjack's Avatar lumberjack Offline Posts: 454
Hi Wolfgang,

AAdd() is quite slow. How does it compare when you use the code as I changed (in blue).

Johan

wriedmann wrote: This was my sample:

function CheckArrayPerformance() as void
local aArray as array
local aDetail as array
local nI as dword
local nJ as dword
local nLen as dword
local nStart as float

nLen := 5000
nStart := Seconds()
[color=blue]aArray := ArrayNew((int)nLen)[/color]
	
for nI := 1 upto nLen
  aDetail := ArrayNew( int( nLen ) )
    for nJ := 1 upto nLen
      aDetail[nJ]			:= nJ * nI 
    next
    [color=blue]aArray[nI] := aDetail[/color]
next
	
Console.WriteLine( "Filling the bidimensional test array with " + NTrim( nLen ) + " elements each took " + NTrim( Seconds() - nStart ) + " seconds" )
	
return

______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5094

  wriedmann's Avatar wriedmann Away Posts: 1549
Hi Johan,

I know that AAdd() is slow, but I have used it to stress the runtime a bit.

In normal application code I would never use such code - I would write as suggested by you.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5095

  lumberjack's Avatar lumberjack Offline Posts: 454
Hi Wolfgang,

Was just mentioning it since using AAdd() in both instances or ArrayNew(), will show the performance penalty to the "lazy" programmers out there...

Johan
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5096

  FFF's Avatar FFF Offline Posts: 571
Johan, Wolfgang,
copied J's code to the same app i made for W's. Renamed func and let them run one after another.
Result for W: 2,29s,
for Johan 2,32 (!)
Then swapped the calls getting 2,28 and 2,33
Killed Xide, restarted, compile and swap again, result similiar.
=> "lazy ones" don't get punished as much as they used to be ;)

@all: i'd suggest at least for small test apps, to post always a complete export file.

Karl

Please Log in or Create an account to join the conversation.

Last edit: by FFF. Reason: typo

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5097

  wriedmann's Avatar wriedmann Away Posts: 1549
Hi Karl,

you results are speaking for a very good inplementation in the runtime.

Sincerely, I use much more AAdd() calls than ArrayNew() class - simply because most of the time at the start of the loop I don't know the number of elements the array will have at the end.

Wolfgang

P.S. will do that with the sample applications the next time I have one
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5100

  lumberjack's Avatar lumberjack Offline Posts: 454
Hi Wolfgang/Karl,

wriedmann wrote: your results are speaking for a very good implementation in the runtime.

I agree, hats of to teamX# again!
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5101

  Chris's Avatar Chris Offline Posts: 1149

FFF wrote: @Chris: there's a trap in XIDE: created a new X# core sample, added the x#runtime references, (Core&VO). Platform auto-changed to x86. clicking on anyCpu (or x64) works, compiles and runs, but silently switches back to x86!


Thanks Karl, will fix this. It's only a UI thing, when you select Vulcan/VO dialects, x86 gets also selected, because that is necessary when using the vulcan dll files which are all x86 only.

You can actually change the platform to AnyCPU manually and it will be used from now, will just reset in the UI, next time you go to the app properties.

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 4 weeks ago #5103

  rjpajaron's Avatar rjpajaron Offline Posts: 191
Count me, one of those "lazy coders" but I do not use ArrayNew(..), mostly ary := {} and AAdd.
--

Rene Pajaron

Please Log in or Create an account to join the conversation.

Last edit: by rjpajaron.

Performance comparison X# runtime vs Vulcan runtime 11 months 2 weeks ago #5230

  g.bunzel@domonet.de's Avatar g.bunzel@domonet.de Offline Posts: 9
...maybe offtopic - but some performace infos out of this article:
www.codeproject.com/Articles/159450/fastJSON#perftests


I did a lot of performance tuning with a profiler and here are my results:
•Always use a StringBuilder and never strings concats.
•Never do the following stringbuilder.append("string1 + "string2") because it kills performance, replace it with two stringbuilder appends. This point blew my mind and was 50% faster in my tests with the profiler.
•Never give the stringbuilder a capacity value to start with e.g. var stringbuilder = new StringBuilder(4096); . Strange but it is faster without it.
•I tried replacing the StringBuiler with a MemoryStream but it was too slow (100% slower).
•The simplest and the most direct way is probably the fastest as well, case in point reading values as opposed to lexer parser implementations.
•Always use cached reflection properties on objects.


HTH

Gerhard Bunzel

Please Log in or Create an account to join the conversation.

Last edit: by g.bunzel@domonet.de.

Performance comparison X# runtime vs Vulcan runtime 11 months 2 weeks ago #5231

  Chris's Avatar Chris Offline Posts: 1149
Hi Gerhard,

g.bunzel@domonet.de wrote: •Never give the stringbuilder a capacity value to start with e.g. var stringbuilder = new StringBuilder(4096); . Strange but it is faster without it.


That should depend on the details. If you are creating lots of StringBuilders and most of them end up being just a few characters long, then StringBuilder{4096} (setting Capacity to 4096) will be overkill, it will be using too much (wasted) memory and will be also slower. But if you know that a certain StringBuilder will end up having around 4000 characters, then using StringBuilder{4096} should be much faster than using a simple StringBuilder{}. And the difference would be a lot larger for longer sting(builder)s.

What StringBuilder{4096} does, is to pre-allocate memory for 4096 characters, so it will not need to allocate more and more memory while the StringBuilder increases in size (but remains smaller than the specified length). Otherwise, it allocates memory for just 16 characters (the default Capacity), and if it actually reaches that size, next time you add a character, it allocates now memory for 32 characters in a new buffer, copies the old data from the old buffer to the new one and releases the previous memory buffer. Same when you reach 32 characters, in allocates another buffer for 64 characters, copies over the data again etc.

So, in general, it is much more efficient (regarding speed and memory consumption/strain to the garbage collector) specifying an initial Capacity, but only if you know in advance how long your StringBuilder will end up. Always setting up Capacity to a large number even for very small StringBuilders, will indeed hurt performance.

Btw, the same applies to ArrayLists, List<>s and almost every other standard .Net collection.
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Performance comparison X# runtime vs Vulcan runtime 11 months 2 weeks ago #5263

  ic2's Avatar ic2 Offline Posts: 471
Hello Johan,

lumberjack wrote:
Was just mentioning it since using AAdd() in both instances or ArrayNew(), will show the performance penalty to the "lazy" programmers out there...


I'm catching up forum messages and I was intrigued by this remark. I have many places in my program where I use AAdd. E.g. we want a total of a series of general ledger accounts and for every record with a booking on a GL, we use AScan to see if we already added that GL in an array, if not, we AAdd to the GL array and the total value array.

Seems a good way to me, even AAdd is poor regarding performance.

What would the non lazy programmer do?

Dick

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2