cost of calling class function
Johan Engelen via Digitalmars-d
digitalmars-d at puremagic.com
Thu Feb 23 08:25:34 PST 2017
On Wednesday, 22 February 2017 at 23:49:43 UTC, DuĊĦan Pavkov
wrote:
>
> If the function is outside of class code runs much faster. I'm
> obviously doing something wrong and would appreciate any help
> with this.
Interesting test case, thanks :-)
Adding "final" to the class method nullifies the speed difference.
Somehow, LDC does not devirtualize the call in your testcase.
Without the for-loops the call is nicely devirtualized, so no
performance difference.
-Johan
More information about the Digitalmars-d
mailing list