summaryrefslogtreecommitdiffstats
path: root/common/collection/collection_priv.h
Commit message (Collapse)AuthorAgeFilesLines
* COLLECTION Making iterations pinnableDmitri Pal2009-10-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a feature that helps ELAPI. It makes lookup of the fields that need to be resolved for every event a bit faster. The idea is to be able to put a 'pin' into a specific place while iterating the collection and make this place a new "wrap around" place for the collection. This means that next time you iterate this collection you will start iterating from the next item and the item you got before pin will be last in your iteration cycle. Here is the example: Assume you have two collections that you need to compare and perform some action on collection 1 based on the presense of the item in collection 2. Collection1 = A, B, C, D, E. F Collection2 = A, C, F The usual approach is to try A from collection 1 against A, B, C from collection 2. "A" will be found right away. But to find "F" it has to be compared to "A" and "C" first. The fact that the collections are to some extent ordered can in some cases help to reduce the number of comparisons. If we found "C" in the list we can put a "pin" into the collection there causing the iterator to warp at this "pin" point. Since "D" and "E" are not in the second collection we will have to make same amount of comparisons in traditional or "pinned" case to not find them. To find "F" in pinned case there will be just one comparison. Traditional case = 1 + 3 + 2 + 3 + 3 + 3 = 15 Pinned case = 1 + 3 + 1 + 3 + 3 + 1 = 12 It is a 20% comparison reduction.
* COLLECTION Realigning collection codeDmitri Pal2009-10-051-0/+7
| | | | | | | | | | Created a new module to hold functions related to iterator and iterating collections. Planning to add new functions but the main collection module is already too big. So this patch just moves code around and fixes the build making foundation for the next patch.
* COLLECTION Adding flat traversal & copyDmitri Pal2009-07-151-0/+1
| | | | | | | | | | | | The collection is hearachical. The flattening of the collection was not implemented before both for traversal and copying. This patch introduces functionality to traverse or iterate through collection as flat set and also copy collection into another flattening it and automatically resolving conflicts. Also imptoved tracability and fixed memory leak in unbind iterator code.
* COLLECTION Removing static placeholder structure.Dmitri Pal2009-07-061-0/+1
| | | | | | There was a static global structure used in iteration and in traversing the collection. It has been removed and replaced with a better solution.
* Adding INSERT into collection functionality.Dmitri Pal2009-07-011-1/+3
| | | | | | | | | Add was always insterting at the end of the collection. With this change one can control where the item is inserted and deal with the duplicates too. Also one now can extract items from collection using absolute and relative disposition. Using more advanced hashing function.
* Style fixes for /commonSimo Sorce2009-04-071-1/+1
|
* First commit of basic collection API.Dmitri Pal2009-04-061-0/+70