summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-02-16 19:59:07 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-17 21:23:06 +0100
commitfb8be9905d5f3216edc3fbb72b8ce1c380737eac (patch)
tree87139503e92ad8aac60bcdc59242610884f37573 /tests/benchmarks
parent5d593da3d31a0c6adffb449db3ceb65328b87cd6 (diff)
qAllocMore: Always grow exponentially
qAllocMore is used by growing containers to allocate additional memory for future growth. The previous algorithm would grow linearly in increments of 8 up to 64 and then progress exponentially in powers of two. The new (constant time) algorithm does away with the linear segment and always progresses exponentially. It also has the nice benefit of cleanly avoiding undefined behaviour that the old implementation tried hard to circumvent. Besides always progressing exponentially, the next-power-of-two algorithm was tweaked to always include space for growth. Previously queries at boundary values (powers of two) would return the same value. The test was updated to verify sanity of results. As the algorithm is well behaved, testing of bogus data was dropped. Whatever happens in those cases is irrelevant, anyway: the bug lives elsewhere. Change-Id: I4def473cce4b438734887084e3c3bd8da0ff466b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/benchmarks')
0 files changed, 0 insertions, 0 deletions