From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12302 invoked by alias); 23 Oct 2015 19:26:59 -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: 36926 Received: (qmail 10003 invoked from network); 23 Oct 2015 19:26:59 -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:in-reply-to:comments:to:subject:mime-version :content-type; bh=HYnvpcLyDBg00rDsvigBhzQ1jBW6BERkyIDMIQvYIi0=; b=YRPkAzoWD9G9e9vDrdqcNGk07VkL6D+quftuCHZt45mDyPWHN6YwOvx4HYej1V9iQl 73T3SHSFz6CArFfL3d7XuvGrHSp3bvanE07b3A/JMMQDxFjBxiVWH2YNOONlKZ0Bp7Z5 B/cB5dwovxbFzqMbutMSnsneNKO5PauVaAL0Gp988qktxB0WrV5bpeD5qM+m8SXfwn4o HvNOWCLTHjS5AlM72iqNvWJb8HPxtzaKZFSgkqbR3ksa46kK9L3WENuMoBAv4C02/zYn Pv+e3b/u7sXGklWvmvtU1Z1eu7lR6q7GJDIAZ0wWoxpeZhrf8IT6iBftKM/1Y6CxU4lg J19w== X-Gm-Message-State: ALoCoQlbLky3M0v15dopuePKzPCgGijA6fjCFVz9++TdeA9hmnj/csSQu9QqflJvzUByKdWWQJTY X-Received: by 10.60.57.100 with SMTP id h4mr16213901oeq.71.1445628418047; Fri, 23 Oct 2015 12:26:58 -0700 (PDT) From: Bart Schaefer Message-Id: <151023122655.ZM21177@torch.brasslantern.com> Date: Fri, 23 Oct 2015 12:26:55 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Slowdown around 5.0.5-dev-0" (Oct 23, 8:32am) 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> In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Slowdown around 5.0.5-dev-0" (Oct 23, 5:57pm) X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Sebastian Gniazdowski , 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 23, 8:32am, Sebastian Gniazdowski wrote: } Subject: Re: Slowdown around 5.0.5-dev-0 } } } [ text/plain } Encoded with "quoted-printable" ] : } } I ran the performance tests again with script formatting them } differently - they are aggregated on test function, not on zsh } version. This allows easier interpretation. A new conclusion is that } zhalloc patch doesn't help for string_test. So the first patch (36834) } speeds up string operations and also introduces increased memory } usage. Thanks for the patch. I think you've removed too much; the part about finding the arena with the most space rather than first arena with any space should have stayed, as should the changes to zhalloc() that were included in 36834. Try the below patch against 8e9a68ad1 ? On Oct 23, 5:57pm, Sebastian Gniazdowski wrote: } Subject: Re: Slowdown around 5.0.5-dev-0 } } On 23 October 2015 at 17:40, Sebastian Gniazdowski } wrote: } > I attach the patch that withdraws 9f8e3e8 and 643aca9 (which are 36834) } } One note is that 643aca9 isn't fully from 36834 because: } if (fheap == h) } fheap = NULL; } } Is moved to top of "if (h->next) {". Was this intended? Yes it was, but irrelevant since that whole block is being backed out. diff --git a/Src/mem.c b/Src/mem.c index 68bd767..15d8fd2 100644 --- a/Src/mem.c +++ b/Src/mem.c @@ -294,7 +294,7 @@ pushheap(void) #endif for (h = heaps; h; h = h->next) { - DPUTS(!h->used && h->next, "BUG: empty heap"); + DPUTS(!h->used, "BUG: empty heap"); hs = (Heapstack) zalloc(sizeof(*hs)); hs->next = h->sp; h->sp = hs; @@ -339,10 +339,12 @@ freeheap(void) * of stuff already on the heap, this is an enormous amount of work, * and performance goes to hell. * - * Therefore, we defer freeing the most recently allocated arena until - * 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 @@ -386,26 +388,6 @@ freeheap(void) VALGRIND_MEMPOOL_TRIM((char *)h, (char *)arena(h), h->used); #endif } else { - if (fheap == h) - fheap = NULL; - if (h->next) { - /* We want to cut this out of the arena list if we can */ - if (h == heaps) - hl = heaps = h->next; - else if (hl && hl->next == h) - hl->next = h->next; - else { - DPUTS(hl, "hl->next != h when freeing"); - hl = h; - continue; - } - h->next = NULL; - } else { - /* Leave an empty arena at the end until popped */ - h->used = 0; - fheap = hl = h; - break; - } #ifdef USE_MMAP munmap((void *) h, h->size); #else @@ -473,19 +455,6 @@ popheap(void) hl = h; } else { - if (h->next) { - /* We want to cut this out of the arena list if we can */ - if (h == heaps) - hl = heaps = h->next; - else if (hl && hl->next == h) - hl->next = h->next; - else { - DPUTS(hl, "hl->next != h when popping"); - hl = h; - continue; - } - h->next = NULL; - } #ifdef USE_MMAP munmap((void *) h, h->size); #else