[Gambas-user] Performance figures for various ways to do reflective method calls
Brian G
brian at westwoodsvcs.com
Tue Oct 17 02:19:04 CEST 2023
Hi martin,
There is one more method to use which is defining ckey as an object
Dim key3 As Object = New Ckey
Debug "Start method direct call... object"
startTime = Now()
For i As Long = 1 To iterations
result = key3._equals(key2)
Next
Debug Subst("Done in &1ms", DateDiff(startTime, Now, gb.Millisecond))
the timing looks like this
Main.Main.15: Start method direct call...
Main.Main.20: Done in 765ms
Main.Main.22: Start method direct call... object
Main.Main.27: Done in 1156ms
Main.Main.29: Start method reflective call...
Main.Main.34: Done in 5220ms
Main.Main.41: Start method eval call...
Main.Main.48: Done in 4554ms
Main.Main.50: Start blind method variant call...
Main.Main.57: Done in 1332ms
"Failure is the key to success;
each mistake teaches us something" .. Morihei Ueshiba
Brian G
----- On Oct 13, 2023, at 4:47 PM, Martin Fischer martin.fischer6 at web.de wrote:
> Hi fellow gambassians,
>
> I was interested in the performance of reflective method calls in
> gambas. I tested:
> - direct (early bound) method call
> - reflective via Object.Call
> - reflective via gb.eval
> - reflective via Variant
>
> Here are the numbers:
>
> Main.Main.11: Start method direct call...
> Main.Main.16: Done in 540ms
> Main.Main.18: Start method reflective call...
> Main.Main.23: Done in 4135ms
> Main.Main.30: Start method eval call...
> Main.Main.37: Done in 3469ms
> Main.Main.39: Start blind method variant call...
> Main.Main.46: Done in 1185ms
>
> The absolute numbers are not relevant. These figures answer the
> question: "how much slower is reflective call compared to direct call".
>
> Tiny Project is attached, if you want to reproduce.
>
> Regards
> ____________________________________
> Martin Fischer
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
More information about the User
mailing list