Re: Optimisation, function returns, STL containers

From: lilburne (lilburne_at_godzilla.net)
Date: 11/12/03

  • Next message: master0515: "write c++ code for fee"
    Date: Wed, 12 Nov 2003 20:25:43 +0000
    
    

    Victor Bazarov wrote:
    > "Simon Elliott" <simon@nospam.demon.co.uk> wrote...
    >
    >>What optimisation do compilers typically provide when passing STL
    >>containers around?
    >
    >
    >>
    >>In theory there's a whole lot of unnecessary copying going on here, in
    >>the "push_back"s and the getBloggsList() return. How much of this is the
    >>compiler allowed to optimise away?
    >
    >
    > The construction of 'myBloggList' object is permitted to happen
    > "in place" (see 12.8/15). It's called "return value optimisation".
    >

    Though it won't happen in assignments, so you'll need to be
    carefull of any other statements like:

       myBloggsList = getBloggsList();

    which isn't a construction. But you should be aware of this
    with any object that is returned by value.


  • Next message: master0515: "write c++ code for fee"

    Relevant Pages

    • Re: C99: Suggestions for style(9)
      ... you can mix statements and declarations. ... change until all K&R code is removed from FreeBSD. ... how today's compilers handle:>unaliased local variables. ... primitive types when optimisation was enabled. ...
      (freebsd-hackers)
    • Re: To Richard Heathfield: enoughs enough
      ... And what you called micro optimisation was not micro optimisation. ... > and Optimization are the norm, or that all compilers use yacc, bottom ... hardware that can do 1000 comparisons every clock cycle and figure ... > makes an Ofor loop into an Ofor loop when this for is the ...
      (comp.programming)
    • Re: a LISP raytracer
      ... >> Optimisation and type inference is a real weak point of CMUCL and SBCL ... Compared to other Lisp compilers, ... > is hard to compare. ...
      (comp.graphics.rendering.raytracing)
    • Re: a LISP raytracer
      ... >>> Optimisation and type inference is a real weak point of CMUCL and SBCL ... >>> compared compilers for other languages, like Stalin, MLton and ocamlopt. ... >> is hard to compare. ... GCs in commercial Lisp tend to be optimized ...
      (comp.graphics.rendering.raytracing)
    • Re: a LISP raytracer
      ... Optimisation and type inference is a real weak point of CMUCL and SBCL ... compared compilers for other languages, like Stalin, MLton and ocamlopt. ... Only if your GC is inefficient. ...
      (comp.graphics.rendering.raytracing)