D and a bazillion of small objects

2010-06-02 Thread Yao G.
Hello everybody. What's the best practice or more efficient way to deal, in D, with lots of small objects? My problem is this: I have a small control, ListView. This control can have hundreds (and theoretically thousands) of items (ListViewItem instances, to be precise). And, in turn each o

Re: D and a bazillion of small objects

2010-06-02 Thread bearophile
Yao G.: > Hello everybody. > > What's the best practice or more efficient way to deal, in D, with lots of > small objects? My problem is this: I have a small control, ListView. This > control can have hundreds (and theoretically thousands) of items > (ListViewItem instances, to be precise).

Re: D and a bazillion of small objects

2010-06-02 Thread Yao G.
Thanks bearophile. With respect to passing structs as reference, I also have this problem. In the widget, I have a opIndex method, that returns a ListViewItem given an index (like an array). When opIndex return the instance I'm looking for, and then I modify some property (a image index, fo

Re: D and a bazillion of small objects

2010-06-02 Thread Simen kjaeraas
Yao G. wrote: Thanks bearophile. With respect to passing structs as reference, I also have this problem. In the widget, I have a opIndex method, that returns a ListViewItem given an index (like an array). When opIndex return the instance I'm looking for, and then I modify some property (

Re: D and a bazillion of small objects

2010-06-02 Thread Yao G.
Yeah. I think I'll do that. I just hope that no temporary copy is created in other item access or manipulation. Thanks. On Wed, 02 Jun 2010 20:04:53 -0500, Simen kjaeraas wrote: Yao G. wrote: Thanks bearophile. With respect to passing structs as reference, I also have this problem.

Re: D and a bazillion of small objects

2010-06-03 Thread Kagamin
You can use another design: feed your control with your items collection and interface like string opIndex(size_t item, size_t subItem); string opIndexAssign(size_t item, size_t subItem, string newValue); void sort(size_t subItem, bool asc=true); which will be used by the control to present the

Re: D and a bazillion of small objects

2010-06-03 Thread bearophile
Yao G.: > I think the idea of a memory pool or freelist is good. Can you point me > where can I see your libs? Instead of just giving you a link to the dlibs1, I've extracted the relevant code and adapted it to D2: http://codepad.org/Ug5Z5qum I have tested it enough with D1 but only a bit with

Re: D and a bazillion of small objects

2010-06-03 Thread Yao G.
Thanks bearophile. I'll give it a try later. -- Yao.G On Thu, 03 Jun 2010 12:27:20 -0500, bearophile wrote: Yao G.: I think the idea of a memory pool or freelist is good. Can you point me where can I see your libs? Instead of just giving you a link to the dlibs1, I've extracted the re