Re: cost of calling class function

2017-02-23 Thread Chris Wright via Digitalmars-d
On Wed, 22 Feb 2017 18:31:37 -0800, Jonathan M Davis via Digitalmars-d wrote: > On Thursday, February 23, 2017 02:17:02 Jeremy DeHaan via Digitalmars-d > wrote: >> On Thursday, 23 February 2017 at 01:48:40 UTC, Seb wrote: >> > AFAICT though it was approved, the switch to final by default has >> >

Re: cost of calling class function

2017-02-23 Thread Johan Engelen via Digitalmars-d
On Thursday, 23 February 2017 at 19:57:18 UTC, Patrick Schluter wrote: Marking the method as @pure changes anything? Here is the link to play with it yourself :-) https://godbolt.org/g/se4dCZ

Re: cost of calling class function

2017-02-23 Thread Patrick Schluter via Digitalmars-d
On Thursday, 23 February 2017 at 17:02:55 UTC, Johan Engelen wrote: On Thursday, 23 February 2017 at 16:25:34 UTC, Johan Engelen wrote: [...] We're in good company: both clang and gcc also do not devirtualize the call when the loopcount is too large (when the loop count is 4, the indirect

Re: cost of calling class function

2017-02-23 Thread Johan Engelen via Digitalmars-d
On Thursday, 23 February 2017 at 16:25:34 UTC, Johan Engelen wrote: 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

Re: cost of calling class function

2017-02-23 Thread Johan Engelen via Digitalmars-d
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

Re: cost of calling class function

2017-02-22 Thread Jonathan M Davis via Digitalmars-d
On Thursday, February 23, 2017 02:17:02 Jeremy DeHaan via Digitalmars-d wrote: > On Thursday, 23 February 2017 at 01:48:40 UTC, Seb wrote: > > AFAICT though it was approved, the switch to final by default > > has never happened. > > I believe Andrei made an executive decision to shut down final

Re: cost of calling class function

2017-02-22 Thread Jeremy DeHaan via Digitalmars-d
On Thursday, 23 February 2017 at 01:48:40 UTC, Seb wrote: AFAICT though it was approved, the switch to final by default has never happened. I believe Andrei made an executive decision to shut down final by default.

Re: cost of calling class function

2017-02-22 Thread Seb via Digitalmars-d
On Wednesday, 22 February 2017 at 23:49:43 UTC, Dušan Pavkov wrote: Hello, I have tried to measure how much would some simple task be faster in D than in C#. I ported some simple code from C# to D 1:1 almost without changes and C# code was faster. After eliminating causes one by one I have

cost of calling class function

2017-02-22 Thread Dušan Pavkov via Digitalmars-d
Hello, I have tried to measure how much would some simple task be faster in D than in C#. I ported some simple code from C# to D 1:1 almost without changes and C# code was faster. After eliminating causes one by one I have an example which shows where the problem is. If the function is