On Tue, 2011-09-20 at 23:27 -0400, Jay Taoko wrote: > On 9/20/2011 10:48 PM, Ted Gould wrote: > > On Wed, 2011-09-21 at 11:43 +1200, Tim Penhey wrote: > >> We can see that calloc is faster only at small sizes. What's more, the > >> overhead of using a std::vector decreases rapidly as the size gets > >> larger. > > And aren't almost all allocations in most programs smaller in nature. > > Especially GUI programs and toolkits. The only place I could think we'd > > even come close to "large" allocations would be in buffer images, and > > there shouldn't be too many of those. > > > > I think that the old adage still holds: If you want something done > > right, do it yourself. But often times you're willing to take the > > penalty and outsource the work to the standard lib to make life easy in > > non-critical sections. So "use the appropriate technology for the code > > in question." ;-) > > The section in question creates a buffer of data to load into and OpenGL > texture. So the data can be large. > However, in that location, we are doing 1 allocation and then we exit. > Is one really better than the other in this case?
I would say no. In general, I'd say any discussion over the style of one allocation is bike shedding. Who ever writes the code gets to decide :-) --Ted
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Mailing list: https://launchpad.net/~ayatana-dev Post to : ayatana-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~ayatana-dev More help : https://help.launchpad.net/ListHelp