Re: Profiling calls to small functions

2017-01-22 Thread albert-j via Digitalmars-d-learn
I'm not sure if it's what happening in this case but, in code as simple as this, function calls can sometimes be the bottleneck. You should see how compiling with/without -O affects performance, and adding `pragma(inline)` to funcB. I guess my question is whether it is possible to have

Re: Profiling calls to small functions

2017-01-21 Thread albert-j via Digitalmars-d-learn
I'm not sure if it's what happening in this case but, in code as simple as this, function calls can sometimes be the bottleneck. You should see how compiling with/without -O affects performance, and adding `pragma(inline)` to funcB. When compiled with -inline, the profiler does not report the

Re: Profiling calls to small functions

2017-01-21 Thread pineapple via Digitalmars-d-learn
On Saturday, 21 January 2017 at 12:33:57 UTC, albert-j wrote: Now I dmd -profile it and look at the performance of funcA with d-profile-viewer. Inside funcA, only 20% of time is spend in funcB, but the rest 80% is self-time of funcA. How is it possible, when funcB has three times the

Profiling calls to small functions

2017-01-21 Thread albert-j via Digitalmars-d-learn
Let's say I want to create an array of random numbers and do some operations on them: void main() { import std.random; //Generate array of random numbers int arrSize = 1; double[] arr = new double[](arrSize); foreach (i; 0..arrSize) arr[i] = uniform01();