Blender Git Commit Log

Git Commits -> Revision fe9b21a

Revision fe9b21a by Bastien Montagne (master)
February 20, 2016, 14:28 (GMT)
Add GHash/GSet pop() feature.

Behavior is similar to python's set.pop(), it removes and returns a 'random' entry from the hash.

Notes:
* Popping will return items in same order as ghash/gset iterators (i.e. increasing
order in internal buckets-based storage), unless ghash/gset is modified in between.
* We are keeping a track of the latest bucket we popped out (through a 'state' parameter),
this allows for similar performances to iterators when iteratively popping a whole hash
(without it, we are roughly O(n!), with it we are roughly O(n)...).

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1808

Commit Details:

Full Hash: fe9b21a44ad25f068da88f6e12b60c1486be3605
Parent Commit: 90e77c8
Lines Changed: +177, -0

4 Modified Paths:

/source/blender/blenlib/BLI_ghash.h (+18, -0) (Diff)
/source/blender/blenlib/intern/BLI_ghash.c (+102, -0) (Diff)
/tests/gtests/blenlib/BLI_ghash_performance_test.cc (+15, -0) (Diff)
/tests/gtests/blenlib/BLI_ghash_test.cc (+42, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021