From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22590 invoked by alias); 24 Oct 2015 19:39:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36943 Received: (qmail 28863 invoked from network); 24 Oct 2015 19:39:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=nV6eGrWmaLoZk1ZCwdhOEstyiaH4PxdM9sg3kIhS0t8=; b=RpPXYWfRmJFsoOzEgFeE68w35Jtxz/6GoH+vaxbeh+7Jnr0qVzvxuw1pvw9rI6ggKr motD/CawFtoXs2/Lu9ik3zy5aH5rZh/0RWMQwjDJqKwb5olBYH5maMaBbV78g58vjzZ1 rIEzHrIGACrwMoOVF+c5SbBMtoL/jlM8MEHXaRBzH1uewDU0yGCKsMCzQvaMt4p0CsMu P6zm7K9JKUTP6pg/Is99ukYshCTHGZt7ppbLXidXM5CA4jNv/s7/dpB4m/Fm0S6bVANm RSBRdJvtRNxGgxgTqyoHEGdhEokrm5q789pCBtzt/NxpN5wK6fp/EgG8hm53dBVY3mQW fhDw== X-Gm-Message-State: ALoCoQmpyAM78uJNTZ7uIhS8nw+Dwk0MVVAy38ubYlgtQMkpSX17WUhrhNP2iauv1fOxHzV4hS+7 X-Received: by 10.202.183.3 with SMTP id h3mr17070675oif.58.1445715586600; Sat, 24 Oct 2015 12:39:46 -0700 (PDT) From: Bart Schaefer Message-Id: <151024123943.ZM30236@torch.brasslantern.com> Date: Sat, 24 Oct 2015 12:39:43 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Slowdown around 5.0.5-dev-0" (Oct 24, 9:37am) References: <151010105849.ZM10144@torch.brasslantern.com> <151010170623.ZM16166@torch.brasslantern.com> <151010232045.ZM12931@torch.brasslantern.com> <151011091757.ZM27755@torch.brasslantern.com> <151011103121.ZM8814@torch.brasslantern.com> <151011142204.ZM9103@torch.brasslantern.com> <151012070105.ZM15099@torch.brasslantern.com> <151012173304.ZM15477@torch.brasslantern.com> <151013085246.ZM30504@torch.brasslantern.com> <20151014142722.282d0c5a@pwslap01u.europe.root.pri> <151014092536.ZM32511@torch.brasslantern.com> <151014095009.ZM19954@torch.brasslantern.com> <151014213224.ZM15646@torch.brasslantern.com> <151015173554.ZM30733@torch.brasslantern.com> <151019102117.ZM32700@torch.brasslantern.com> <151022080024.ZM6471@torch.brasslantern.com> <151023122655.ZM21177@torch.brasslantern.com> <151023165006.ZM25785@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Slowdown around 5.0.5-dev-0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 24, 9:37am, Sebastian Gniazdowski wrote: } } So the thing is that your patch from yesterday retains search_test } speed up of 36834, while fixing the memory issues of 36834. Together } with 36836, this gives full retain of search_test speedup, nothing is } lost, speed of pattern matching is as high as with no revert from } current head state. What's lost is string_test speedup 36834 gave, } however, it did so with cost of increased memory usage OK, let's try it this way. This retains MOST of 36834, but puts back scanning the entire heap if we intend to free the block to which the current fheap pointer refers. (This is a patch against 8e9a68ad but applies to current head.) diff --git a/Src/mem.c b/Src/mem.c index 68bd767..ca9ab96 100644 --- a/Src/mem.c +++ b/Src/mem.c @@ -343,6 +343,12 @@ freeheap(void) * we reach popheap(). This may fail to reclaim some space in earlier * arenas. * + * However, if the arena to which fheap points is unused, we want to + * free it, so we have no choice but to do the sweep for a new fheap. + */ + if (fheap && !fheap->sp) + fheap = NULL; /* We used to do this unconditionally */ + /* * In other cases, either fheap is already correct, or it has never * been set and this loop will do it, or it'll be reset from scratch * on the next popheap(). So all that's needed here is to pick up Here are my results for that; memory usage is comparable to 36926 while speed is improved. Running [zsh-HEAD]: string_test 23203.72 Running [zsh-36926]: string_test 38478.23 Running [zsh-HEAD+rescan]: string_test 28787.44 Running [zsh-HEAD]: array_test 6261.07 Running [zsh-36926]: array_test 6269.27 Running [zsh-HEAD+rescan]: array_test 6269.94 Running [zsh-HEAD]: function_test 29609.59 Running [zsh-36926]: function_test 30133.26 Running [zsh-HEAD+rescan]: function_test 30237.71 Running [zsh-HEAD]: search_test 4209.37 Running [zsh-36926]: search_test 4194.97 Running [zsh-HEAD+rescan]: search_test 4260.73