]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
trie_it nitpick: reduce the initial stack size
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 19 Sep 2018 14:57:24 +0000 (16:57 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 16 Oct 2018 13:35:59 +0000 (15:35 +0200)
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).

lib/generic/trie.c

index 9cf5033747c84c1b96603b99fc4c00f612190161..b2abee8c78643ad1c14c65f746372d692385676b 100644 (file)
@@ -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). */