On Wed, Jan 03, 2018 at 07:02:28AM +0000, Tim Hsu via Digitalmars-d-learn wrote: > On Tuesday, 2 January 2018 at 22:49:20 UTC, Adam D. Ruppe wrote: > > On Tuesday, 2 January 2018 at 22:17:14 UTC, Johan Engelen wrote: > > > Pass the Vector3f by value. > > > > This is very frequently the correct answer to these questions! Never > > assume ref is faster if speed matters - it may not be. > > However speed really matters for me.
That's why you need to use a profiler to find out where the hotspots are. It may not be where you think it is. > I am writing a path tracing program. Ray will be constructed million > of times during computation. And will be passed to functions to test > intersection billion of times. After Reading comments here, it seems > ray will be passed by value to the intersection testing function. I am > not sure if ray is small enough to be passed by value. It needs some > experiment. With modern CPUs with advanced caching, it may not always be obvious whether passing by value or passing by reference is better. Always use a profiler to be sure. T -- If blunt statements had a point, they wouldn't be blunt...