From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ITt1EZwwQWKS7QAAgWs5BA (envelope-from ) for ; Mon, 28 Mar 2022 05:50:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id OLNcDZwwQWI5EQEAauVa8A (envelope-from ) for ; Mon, 28 Mar 2022 05:50:52 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AEF12203FF for ; Mon, 28 Mar 2022 05:50:51 +0200 (CEST) Received: from localhost ([::1]:33090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYgP4-00077v-BW for larch@yhetil.org; Sun, 27 Mar 2022 23:50:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYgOK-00077d-U2 for guix-devel@gnu.org; Sun, 27 Mar 2022 23:50:04 -0400 Received: from [2607:f8b0:4864:20::829] (port=41646 helo=mail-qt1-x829.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYgOI-0007Kz-S5; Sun, 27 Mar 2022 23:50:04 -0400 Received: by mail-qt1-x829.google.com with SMTP id d15so11329364qty.8; Sun, 27 Mar 2022 20:50:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:newsgroups:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=y5T90eKku5iPM1C8ZGyq/bePE2Xkru0oRBHpmI6LgWU=; b=Qt0y4ke/EaB5WYXvkELyB508ErCuTggibzOJ2GV9Jibh+83vBach1y/o5MECILai9o wnn/WzcaHTg9w2WFDLpsKk1rFa2gHxSZ8jH+sSznu4X2+skOhZrlYP2JKr2m4/1hv7ng R2q52kOPisuF7MDA1UmWdauesK9Cx4ZYfK2wPk9x/5zrfQEnwNEaFKzGa8kon58vyU1X APyKWgqaaHdR4Eg/J7399sJ9ZtEgQBN5H/OrHwwp9BcL8l3KETiwjZ0Z+BJ5gSagdvuQ hmBMqpwQQw1b1b7M74NJEEYU9sa7c7y207yeFjGov/QAIsAQNz5gjCGC8JpoZPvD0zQ9 gY2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:newsgroups:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=y5T90eKku5iPM1C8ZGyq/bePE2Xkru0oRBHpmI6LgWU=; b=5v1N2qmkWcZi+ZBCwc9Rb0zRXw7skHeedRqWiQnyEo7CB0Qy2k9tFBQAapGGy5Ts1Z riIXC3dxjW1fXXKtcHz1XJd13i8JacTHfm3zGVIiuDFGM+nJk6F1SgB3VhApM+MwwBeS 7Gcp2yPPTfm7CKaxkom4cxk3ijZ+0+2N11U5r+QnTssqk6VM6yUEh6zqK2zG/B3xVgB7 Jy+nXVcCnHCFDsQMPMrXrUKiUzMqFqmB7h6lyRXLJSxEaBtkgJC/H4E+AatGZiqTIUVx tzE/4pS+ZJX5N5eKfRUXD1/YzRXPnnDbQUXEOuHB8ljMo1LFeLUFvLjMY4fE4CfJKCDw 0PQw== X-Gm-Message-State: AOAM533VKxgp2Ce/z52tNKiKjrbHDBZFeqAEv9sbdiw9/ItlcUpxLqrM XMU+wsWArONSwJlgJjGrH6vFHo6mUCg= X-Google-Smtp-Source: ABdhPJz5ZOUc0r3QKEoSBsO74BHi70SHEnfz1DW8LRH02PyjF00exxHsu5c/4aimebzWJvjEC82mxA== X-Received: by 2002:ac8:5e54:0:b0:2e2:2bbf:801 with SMTP id i20-20020ac85e54000000b002e22bbf0801mr20449670qtx.489.1648439400950; Sun, 27 Mar 2022 20:50:00 -0700 (PDT) Received: from hurd (dsl-156-168.b2b2c.ca. [66.158.156.168]) by smtp.gmail.com with ESMTPSA id 21-20020ac85715000000b002e1ce9605ffsm11916507qtw.65.2022.03.27.20.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Mar 2022 20:50:00 -0700 (PDT) From: Maxim Cournoyer Newsgroups: To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Profiling of man-db database generation with zlib vs zstd References: <875yo53iuq.fsf@gmail.com> <87ee2r9gms.fsf@gnu.org> Date: Sun, 27 Mar 2022 23:49:59 -0400 In-Reply-To: <87ee2r9gms.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Thu, 24 Mar 2022 22:37:15 +0100") Message-ID: <87o81qviqg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::829 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::829; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x829.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648439452; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=y5T90eKku5iPM1C8ZGyq/bePE2Xkru0oRBHpmI6LgWU=; b=cFZs9TZHnATKI1f1u6CPkY5XcchfEFO+rA2dpKT1Q13ldAh/S7GmUiRZH4ir17LCv7A8GB Gbrw19KYTX+RzZvLVKQZLdyO8Xl6aU2mwh7ZEByQImMExJwaN8pGcB050SeJ7vWc4Vk7sh WeIddlolm+ktH6SYUJBUlLVhYiqzO94Q1meJ27HVNW8ME1lV9UDa/ZEJCUHEM9lSEkm8td xCPSpAB3JC65BnHOCRN41iAEBtljVP/zP0Vg5jnaGwiVEhjxQNs2CNHZv0O4oYTZFZigKX Pf4Hqws9PgAmZ74MP2ihV3Pb4/1qIJYixNbHxRwEcj/qu3VIwIegLjq3k4mfbQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648439452; a=rsa-sha256; cv=none; b=Y9n8ue1fk+PIWQ5nQV/KpP5jx9c6CQRbKcybrhucIe9npk+/Cyt2V3Lm9a3VojTJssJNjW HNQt01D+dZscBKjiHtliCtagcGVbkbvcHEoc5FMId22MPNFFQ9BWtPvFFNQ8JYPUC9BX13 Arj8ADis9xzB3dx3pZroMWGinm1qrCgiTzIihCvE9rc3bWcZuqzB1PGcGPPlsnJg55d9a6 usnedbRlM8X0KGFEoLxCqgyLm6SyIsfBcCHDHsGPTd0qkw4h7f6Htr9KWNMh/PP2AguWc2 4tTG51hL+mhlMkZPcUsR3KkIWRHqXS8XkP901DKNBseAuIDuH0ZCxEqQY9DsOQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Qt0y4ke/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.67 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Qt0y4ke/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: AEF12203FF X-Spam-Score: -5.67 X-Migadu-Scanner: scn0.migadu.com X-TUID: GpnJmJAaFtYr Hi again, Here I decided to look at the raw performance of guile-zstd vs guile-zlib when decompressing the ungoogled-chromium source into a 4 GiB something tarball. You'll need to generate the tar.zst and tar.gz yourself, but the script that was used is: --8<---------------cut here---------------start------------->8--- ;; decompress-zstd.scm (use-modules (ice-9 binary-ports) (ice-9 match) (statprof) (zstd)) (define MiB (expt 2 20)) (define input-file "/tmp/chromium-98.0.4758.102.tar.zst") (define output-file "/dev/null") (define (decompression-test) (call-with-input-file input-file (lambda (port) (call-with-zstd-input-port port (lambda (input) (call-with-output-file output-file (lambda (output) (let loop ((bv (get-bytevector-n input (* 4 MiB)))) (match bv ((? eof-object?) #t) (bv (put-bytevector output bv) (loop (get-bytevector-n input (* 4 MiB))))))))))))) (statprof (lambda () (decompression-test))) --8<---------------cut here---------------end--------------->8--- Compiled and run: --8<---------------cut here---------------start------------->8--- $ alias time+ alias time+='command time -f"cpu: %P, mem: %M KiB, wall: %E, sys: %S, usr: %U"' $ guild compile -O3 /tmp/decompress-zstd.scm $ time+ guile /tmp/decompress-zstd.scm % cumulative self time seconds seconds procedure 48.69 13.93 13.93 anon #x1689100 45.38 12.98 12.98 %after-gc-thunk 3.47 0.99 0.99 bytevector->pointer 0.46 28.59 0.13 zstd.scm:234:2:read! 0.39 0.11 0.11 get-bytevector-n! 0.23 0.22 0.07 system/foreign.scm:150:0:write-c-struct 0.23 0.07 0.07 bytevector-u64-native-set! 0.15 0.07 0.04 system/foreign.scm:167:0:read-c-struct 0.15 0.04 0.04 anon #x1688ed0 0.15 0.04 0.04 assv-ref 0.15 0.04 0.04 system/foreign.scm:91:9 0.08 0.26 0.02 system/foreign.scm:182:0:make-c-struct 0.08 0.02 0.02 put-bytevector 0.08 0.02 0.02 list? 0.08 0.02 0.02 sizeof 0.08 0.02 0.02 pointer->bytevector 0.08 0.02 0.02 make-bytevector 0.08 0.02 0.02 bytevector-u64-native-ref 0.00 28.61 0.00 zstd.scm:273:0:call-with-zstd-input-port 0.00 28.61 0.00 ice-9/ports.scm:438:0:call-with-input-file 0.00 28.61 0.00 /tmp/decompress-zstd.scm:16:12 0.00 28.61 0.00 ice-9/ports.scm:456:0:call-with-output-file 0.00 28.59 0.00 get-bytevector-n 0.00 12.98 0.00 anon #x167aed0 0.00 0.07 0.00 system/foreign.scm:187:0:parse-c-struct 0.00 0.04 0.00 zstd.scm:57:4 0.00 0.04 0.00 srfi/srfi-1.scm:452:2:fold 0.00 0.02 0.00 system/foreign.scm:188:20 --- Sample count: 1298 Total time: 28.614481162 seconds (15.671167152 seconds in GC) cpu: 153%, mem: 39156 KiB, wall: 0:18.92, sys: 0.50, usr: 28.45 --8<---------------cut here---------------end--------------->8--- And for guile-zlib, after adjusting the script to: --8<---------------cut here---------------end--------------->8--- (use-modules (ice-9 binary-ports) (ice-9 match) (statprof) (zlib)) (define MiB (expt 2 20)) (define input-file "/tmp/chromium-98.0.4758.102.tar.gz") (define output-file "/dev/null") (define (decompression-test) (call-with-input-file input-file (lambda (port) (call-with-gzip-input-port port (lambda (input) (call-with-output-file output-file (lambda (output) (let loop ((bv (get-bytevector-n input (* 4 MiB)))) (match bv ((? eof-object?) #t) (bv (put-bytevector output bv) (loop (get-bytevector-n input (* 4 MiB))))))))))))) (statprof (lambda () (decompression-test))) --8<---------------cut here---------------end--------------->8--- I got: --8<---------------cut here---------------start------------->8--- $ time+ guile /tmp/decompress-gzip.scm % cumulative self time seconds seconds procedure 71.18 21.21 21.21 anon #x218af40 20.78 6.19 6.19 %after-gc-thunk 5.33 1.59 1.59 bytevector->pointer 2.39 23.51 0.71 zlib.scm:99:4 0.32 6.29 0.09 zlib.scm:182:2:read! 0.00 29.80 0.00 /tmp/decompress-gzip.scm:16:12 0.00 29.80 0.00 get-bytevector-n 0.00 29.80 0.00 ice-9/ports.scm:456:0:call-with-output-file 0.00 29.80 0.00 zlib.scm:217:0:call-with-gzip-input-port 0.00 29.80 0.00 ice-9/ports.scm:438:0:call-with-input-file 0.00 6.19 0.00 anon #x217ced0 --- Sample count: 1256 Total time: 29.800587574 seconds (8.715080702 seconds in GC) cpu: 124%, mem: 60772 KiB, wall: 0:24.12, sys: 0.56, usr: 29.54 --8<---------------cut here---------------end--------------->8--- This confirms that guile-zstd is not noticeably faster than guile-zlib, which is unexpected. Compare to the command line tools: $ time+ zstd -cdk /tmp/chromium-98.0.4758.102.tar.zst > /dev/null cpu: 99%, mem: 10548 KiB, wall: 0:09.37, sys: 0.30, usr: 9.05 $ time+ gunzip -ck /tmp/chromium-98.0.4758.102.tar.gz > /dev/null cpu: 99%, mem: 2908 KiB, wall: 0:22.29, sys: 0.31, usr: 21.98 where zstd is about 2.3x faster. It's unfortunate that the bulk of the time is spent in "anon" (anonymous proc?), which doesn't say much. Perhaps I should open an issue with the guile-zstd project. Thanks, Maxim