From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 258AE3847700; Wed, 3 Apr 2024 08:49:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 258AE3847700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712134167; bh=XAV1pQFqdvld1Up2AjE8YKLuuTGPkD+755RJeeNagsQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=s0ISURo8x0ge4477Xhq57G/KapEEBaJc+TVi8Dy4i7ZZMlw3ifodMbqjOeEbRwbEt 83lj98QmvvOOWMQMhzJMhI5/1U54bVnikWqNrkcooDoUUZ0XWcaMvOFdEQhpMV1vtf d0D1lAi+9v1t318WNN1KsjEo4CS/b6dbU/fpmTkA= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114563] ggc_internal_alloc is slow Date: Wed, 03 Apr 2024 08:49:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114563 --- Comment #3 from Richard Biener --- Created attachment 57856 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57856&action=3Dedit quick skip-list patch Before: > /usr/bin/time ./cc1plus -quiet -o /dev/null /tmp/a-test-poly.ii -O 173.29user 3.25system 2:56.59elapsed 99%CPU (0avgtext+0avgdata 11311472maxresident)k 0inputs+0outputs (0major+2867887minor)pagefaults 0swaps After: > /usr/bin/time ./cc1plus -quiet -o /dev/null /tmp/a-test-poly.ii -O 161.23user 3.15system 2:44.44elapsed 99%CPU (0avgtext+0avgdata 11308852maxresident)k 0inputs+0outputs (0major+2868137minor)pagefaults 0swaps The patch uses the ->prev pointer to point to the previous entry of the next entry with differing ->bytes. I re-compute the pointers from scratch during release_pages and update during alloc/free but do not merge ranges when allocating. It would be possible to compute/update the skip list pointer during the walk itself at a bit of extra cost there. As said, when we see to maintain a sorted free_pages list this might speed up the walk some more as we can stop after checking the right-size chunk. Doing a better job in release_pages for the madvise case would be good as w= ell. I wonder if anybody has a preference / priority?=