diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-06-01 19:12:36 +0000 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-06-01 19:12:36 +0000 |
commit | 757c4943401d6a1922954cdac6ab8a901c8cbb51 (patch) | |
tree | e543fe4d2acd9e2b0edefbf694af6ca45032c454 /tests | |
parent | 6d43ad2870b9411c409fcd12937e02eb44b2a76c (diff) |
Improve XPath allocator performance
When allocating new pages, make sure that the page has at least 1/4 of the
base page size free. This makes sure that we can do small allocations after
big allocations (i.e. huge node lists) without doing a heap alloc.
This is important because XPath stack code always reclaims extra pages after
evaluating sub-expressions, so allocating a small chunk of memory and then
rolling the state back is a common case (filtering a node list using a
predicate usually does this).
A better solution involves smarter allocation rollback strategy, but the
implemented solution is simple and practical.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@999 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xpath.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 7f74578..f9ae858 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -328,7 +328,7 @@ TEST(xpath_large_node_set) TEST(xpath_out_of_memory_evaluate_concat) { - test_runner::_memory_fail_threshold = 4096 * 2 * sizeof(char_t) + 4096 * 2; + test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2; std::basic_string<char_t> query = STR("concat(\"a\", \""); @@ -354,7 +354,7 @@ TEST(xpath_out_of_memory_evaluate_concat) TEST(xpath_out_of_memory_evaluate_substring) { - test_runner::_memory_fail_threshold = 4096 * 2 * sizeof(char_t) + 4096 * 2; + test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2; std::basic_string<char_t> query = STR("substring(\""); |