[std-interval] C++ interval std

Guillaume Melquiond guillaume.melquiond at ens-lyon.fr
Thu Apr 6 11:25:14 PDT 2006


Le jeudi 06 avril 2006 à 00:31 -0700, Steve Clamage a écrit :

> This result is quite different from other experiments with small structs that 
> showed pass-by-value performing better. One possibility is that the compiler is 
> missing some optimization opportunities. Another is that this example is not 
> representative.

Is your Interval class considered a "small struct" by the ABIs you
tested? According to the AMD64 ABI, it should be, since it is two
doubles; but I am not completely sure. If it is not, then pass-by-value
will go through the stack and will be a lot worse than pass-by-ref. This
would explain your results and it would mean that your example is not
representative at all.

I don't know if it is possible, but in this case it would be nice if you
could modify the ABI so that intervals are passed through registers.
This would tell if there really is a point in not simply using const
references.

Best regards,

Guillaume



More information about the Std-interval mailing list