From 757c4943401d6a1922954cdac6ab8a901c8cbb51 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sun, 1 Jun 2014 19:12:36 +0000 Subject: 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 --- tests/test_xpath.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/test_xpath.cpp') 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 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 query = STR("substring(\""); -- cgit v1.2.3