From: Vladimír Čunát Date: Wed, 19 Sep 2018 14:57:24 +0000 (+0200) Subject: trie_it nitpick: reduce the initial stack size X-Git-Tag: v3.1.0~8^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15da0ab09fd92bab61e76d3ba80765b0311cc9d0;p=thirdparty%2Fknot-resolver.git trie_it nitpick: reduce the initial stack size Using 2kB as start is a bit too much, and it was showing as 0.5% CPU on malloc() called during trie_it_begin(). Let's start at 0.5 kB, as it can grow anyway (only negligible in profile now). --- diff --git a/lib/generic/trie.c b/lib/generic/trie.c index 9cf503374..b2abee8c7 100644 --- a/lib/generic/trie.c +++ b/lib/generic/trie.c @@ -438,8 +438,8 @@ typedef struct trie_it { node_t* *stack; /*!< The stack; malloc is used directly instead of mm. */ uint32_t len; /*!< Current length of the stack. */ uint32_t alen; /*!< Allocated/available length of the stack. */ - /*! \brief Initial storage for \a stack; it should fit in most use cases. */ - node_t* stack_init[2000 / sizeof(node_t *)]; + /*! \brief Initial storage for \a stack; it should fit in many use cases. */ + node_t* stack_init[60]; } nstack_t; /*! \brief Create a node stack containing just the root (or empty). */