Since I'm a new poster here I'll take a moment to introduce myself.
My name is Chris and I've been casually doing C, Forth, and Ada programming on and off for the last six years. I'm not a guru, but I can usually hold my own. I'm also quite anal retentive when it comes to bugs and reliability. But that's just me. Heh.
On to my question.
While browsing the Evas sources.( Evas2, from the head, grabbed yesterday.) I noticed that Evas uses a boatload of hashes and lists to keep track of objects for (what I can see) allocation and de-allocation.
Not that there is anything wrong with this approach. But I was curious if it might not be simpler and more efficient to simply generate an array of keys specifically for the purpose of allocation and de-allocation. One could use a dynamic array when there are no constraints on memory usage, or a fixed array for situations where allocation and deallocation need to be explicitly controlled.
Of course I'm speaking in a very general sense. Perhaps something like this would help...
struct { Object *evas_object;
Object_Key unsigned_int;
} Object_Address;
and then something like this....
Objects Object_Address.Object_Key[];
Then one could write a procedure to pre-generate an array of keys that automatically get assigned to an object upon the object's creation. i.e. Pull a key from the top of the stack and assign it, once the stack is empty, no more objects can be created until a key or keys are pushed back down on the stack. It doesnt matter what order the keys are in, as long as they are all unique.
Of course I'm being deliberately vague here. However it seems that something like this would be quicker than having to walk lists. Of course, keeping the array and the list in sync would be a bit of a challenge.
I may be way off in left field, but I'm considering testing it out here. Any thoughts?
Chris
|