From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#46881: 28.0.50; pdumper dumping causes way too many syscalls Date: Tue, 2 Mar 2021 20:45:04 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="00000000000042cc0805bc93d141" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10566"; mail-complaints-to="usenet@ciao.gmane.io" To: 46881@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 02 21:46:23 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHBuQ-0002Yo-1Z for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Mar 2021 21:46:22 +0100 Original-Received: from localhost ([::1]:57920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHBuO-0000s5-VF for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Mar 2021 15:46:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHBu6-0000rx-PV for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 15:46:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42795) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHBu6-0007jM-IR for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 15:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lHBu6-0004pf-GH for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 15:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Mar 2021 20:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46881 X-GNU-PR-Package: emacs Original-Received: via spool by 46881-submit@debbugs.gnu.org id=B46881.161471794818551 (code B ref 46881); Tue, 02 Mar 2021 20:46:02 +0000 Original-Received: (at 46881) by debbugs.gnu.org; 2 Mar 2021 20:45:48 +0000 Original-Received: from localhost ([127.0.0.1]:54341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHBtr-0004p9-VY for submit@debbugs.gnu.org; Tue, 02 Mar 2021 15:45:48 -0500 Original-Received: from mail-oi1-f174.google.com ([209.85.167.174]:40507) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHBtq-0004ow-Bk for 46881@debbugs.gnu.org; Tue, 02 Mar 2021 15:45:46 -0500 Original-Received: by mail-oi1-f174.google.com with SMTP id 21so13828146oiq.7 for <46881@debbugs.gnu.org>; Tue, 02 Mar 2021 12:45:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=WCycNmA77HpRI9xt4Gr+dg728tCYASb74Wtzho97ICc=; b=pY2GEpx8PsbbHj3XYOjuSr9K6B9Ds6q+sL6N5aJECRVlNu2QxH0d3JZl8YNnqFMVp3 8JLQu7UL74Xu4DJf+NkvURNCcOpM2xfd+y0GL8PFgHdiyL3oKfjXSd1sgVKlePlQvpJq YYdWCoeK9iFehPo+/Q4oiqsdM/OiQ3FKmcgpXKtuwPKphMRxQyGpesymBeao/f4omWXx 6AigW0a6U1qC7RvR/sP41ghmOIcq1ctwEpM1muFuaUQjyD/jNqp9TxMC9wg0biEn+YiR Nc/frP/Pv/dMJJEB75hcY+U1BMQU97vRjDY07OlDi0DaIadYcPlwsmp1sGtL3duaWTo/ knaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=WCycNmA77HpRI9xt4Gr+dg728tCYASb74Wtzho97ICc=; b=LmaDAh1DRZk+bjHXa3gXNz0MZFj1d4CKeG6IF5aU91jNpIm8KC0cwu83FVXSSAl9as 1tXwDW//hpzT0Y6t8TWMMLg4yUsYdgfBl8YHxjd0wok6siErFe+9yzjix0BilEc2mIq4 46UoF0ChVkgaDoAZ1MwuytJjVna+7teIQF1ScCD9Qb6qdY5pQnfeqw7J7XF8R3ncN3u5 xGw31Rj5MqnXJ7zyekJFJtgaMitQ3PTnCIVcbURxJIz5tjVKi98jYkb/ptifkrPFTScX jILr5IK8KJLTmrh/qtWVrvVW0K40eoQemfJV2OgBO1k7XSyGJmqcIJgUTLOZ8To81SpU q91w== X-Gm-Message-State: AOAM532kk53TTkeAOBcHlkbwxycyV9/SmchxhZCXBE3vczRaYDV3yRLW EEut2ORCJXqQy+JJtBJQKz1L57zTTaL53U34T3K/xj9wruN5Lw== X-Google-Smtp-Source: ABdhPJydEwKrvPLuo+xN+t+YFTvZU+QoELiX6iK00P1J+r5SwwAc0CDo08g4BfMZ3hz2TvenDR+jasyaUynu6uMXQUA= X-Received: by 2002:aca:d905:: with SMTP id q5mr1111434oig.30.1614717940575; Tue, 02 Mar 2021 12:45:40 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201239 Archived-At: --00000000000042cc0805bc93d141 Content-Type: text/plain; charset="UTF-8" On Tue, Mar 2, 2021 at 8:35 PM Pip Cet wrote: > I've looked into the problem, and it seems easy to solve and worth it > in terms of debuggability and performance. Very rough benchmarks, but this seems to be clearly worth it: Performance: With patch: real 0m3.861s user 0m3.776s sys 0m0.085s Without patch: real 0m7.001s user 0m4.476s sys 0m2.511s Number of syscalls: With patch: 415442 Without patch: 2028307 > Patch will be attached once this has a bug number. And here's the patch. Testing would be very appreciated. I'm unsure about the precise usage of dump_off vs ptrdiff_t here; I don't think it matters, but suggestions, nitpicks, and comments, on this or any other aspect, would be very appreciated. Pip --00000000000042cc0805bc93d141 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Prepare-pdumper-dump-file-in-memory-write-it-in-one-.patch" Content-Disposition: attachment; filename="0001-Prepare-pdumper-dump-file-in-memory-write-it-in-one-.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_klshagd70 RnJvbSA5MmVlMTM4ODUyYjM0ZWRlMmY0M2RkN2Y5M2YzMTBmYzc0NmJiM2JmIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaXAgQ2V0IDxwaXBjZXRAZ21haWwuY29tPgpEYXRlOiBUdWUs IDIgTWFyIDIwMjEgMjA6Mzg6MjMgKzAwMDAKU3ViamVjdDogW1BBVENIXSBQcmVwYXJlIHBkdW1w ZXIgZHVtcCBmaWxlIGluIG1lbW9yeSwgd3JpdGUgaXQgaW4gb25lIGdvCiAoQnVnIzQ2ODgxKQoK KiBzcmMvcGR1bXBlci5jIChzdHJ1Y3QgZHVtcF9jb250ZXh0KTogQWRkIGJ1ZiwgYnVmX3NpemUs IG1heF9vZmZzZXQgZmllbGRzLgooZ3Jvd19idWZmZXIpOiBOZXcgZnVuY3Rpb24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