April 02, 2004 Re: Template Library | ||||
---|---|---|---|---|
| ||||
Posted in reply to Craig Black | Craig Black wrote: >>Walter did mention something about the GC allocating double the required >>memory. >> >> BTW: I can't remember exactly what big W said so take that with a grain of salt. There's also a capacity thing in gcx.d that get's the capacity of a pointer but I don't think this is accessible. >I don't believe that std::vector just doubles the size. If you observe the >growth rate of std::vector as you add elements, it increases each time by a >certain percentage, say 30% or so. Personally this more conservative >approach is more attractive to me. It wastes less memory and still >maintains decent performance. > > Maybe but I think it depends on the application. If you know your application though you can almost always write a better scheme manually. I don't think D should do this directly (D needs to keep to the metal). I think it should be done as part of the library (as you've suggested). But it seems more like a boost thing then an std thing. I guess the lib would come with a range of pre-defined allocators that can be plugged in. -- -Anderson: http://badmama.com.au/~anderson/ |
Copyright © 1999-2021 by the D Language Foundation