From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.user Subject: string-for-each vs. for-each+string->list performance Date: Sat, 6 Jun 2020 23:27:43 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="332"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Jun 07 08:28:09 2020 Return-path: Envelope-to: guile-user@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 1jhomu-000Xz2-Hy for guile-user@m.gmane-mx.org; Sun, 07 Jun 2020 08:28:08 +0200 Original-Received: from localhost ([::1]:54358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhoms-0000LA-VB for guile-user@m.gmane-mx.org; Sun, 07 Jun 2020 02:28:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhomk-0000L1-53 for guile-user@gnu.org; Sun, 07 Jun 2020 02:27:58 -0400 Original-Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]:45482) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhomj-0007KO-7T for guile-user@gnu.org; Sun, 07 Jun 2020 02:27:57 -0400 Original-Received: by mail-lj1-x231.google.com with SMTP id i27so5638477ljb.12 for ; Sat, 06 Jun 2020 23:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=141lQg7l5EbaoctMFn5rMln1Ygy4y9DGl5FthlxJTFQ=; b=DsoNiD56oZNl3oueUXZhg03UDtyMh4NlCreL0RA8CQFnuJ/oHOzs2mnUwUQjh3xCbN NEM+ShcRXMCXqC5CcKv9gGAJBpn4ulF5X2WDdLPATPriclaqP84PQg9E3lpIrGSmIkRB dfKo7qs19NN7G6+FBM6UQl1bkC1K2g+jHhZ5qaZhlfaLkvauWIHfc/lejqO5hY1np0yU pajlvjLCc4uimsKZLxZJ7cc8JBiqIfjLUogD9QBWUjB2Ktp8Z+wYNHfMiVLGgqE9s2P0 6KO+C2P2ca26GHcoo2Pgj+Sd15GV0LRMjEtD2KRguzMtVxpmL20YCkC62hqlzp96v3eT 9kbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=141lQg7l5EbaoctMFn5rMln1Ygy4y9DGl5FthlxJTFQ=; b=hJidmAF1DdBK3onBAsuWhI6t9AaYbc4txTOAs+M5g7WaaR8RRx9wUv/PR7wmNR19G/ Nnr3zMigaHRxfJfr6K5BKvz8s+Otw1jgQK6nmcpuWHqCeOUd2nLunzQ+WPQD1IZCsDVS qBemN9R9ik8nrQ1EhA1a33oCSdMwVYWo3RMQ7nWAH5C6q/OnaiBnOQwfkZ8eVnS24u1o GSgMP1rPM0tqdSid5lTkVnnGhIjsbWpA/Wo86JnwYtmdnx40gnFj+V/N3a10MWG8qzHH XjxiYyAfEV/jZu0PlsbA7/PMbGid3WvAFy5Y0FUPd+vzp+xdzfb6IK5HmlNW3iE7aSBv CSLg== X-Gm-Message-State: AOAM532RnThsf4nLTmGwEQscJMMmUL88u3lUIcwMrjTc51fInbpeaHIH 1C+OVpVhVNCW1oot3zi5XiXaJ/FRWUM+Hm0iT3xQnxkl X-Google-Smtp-Source: ABdhPJyePmENNdFnwlKNQqqp49R2KPMKktsq+NGcjUyvPlwelFoXITgr/tWDeq7O8lqmaxRx83RU5mgUFoEJtcAohdY= X-Received: by 2002:a2e:8290:: with SMTP id y16mr8774349ljg.340.1591511274932; Sat, 06 Jun 2020 23:27:54 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=aconchillo@gmail.com; helo=mail-lj1-x231.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16553 Archived-At: Hi, in the latest guile-json, 4.1.0. I changed some code to use for-each+string->list. The performance seemed nice and I released it. Christopher Lam pointed out that I could have used string-for-each instead. I made the change but the performance degraded a lot: string-for-each: scheme@(json parser)> ,t (->bool (scm->json-string json)) $19 = #t ;; 17.909537s real time, 18.063382s run time. 0.207281s spent in GC. vs for-each + string->list: scheme@(json parser)> ,t (->bool (scm->json-string json)) $20 = #t ;; 2.998381s real time, 3.319349s run time. 0.471969s spent in GC. string-for-each is implemented in scheme here, if Im not wrong: http://git.savannah.gnu.org/cgit/guile.git/tree/module/rnrs/base.scm#n89 string->list and for-each would use C. Is that huge gap expected? This is with Guile 3.0.2. Best, Aleix