From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.user Subject: goops speedups Date: Sat, 10 Oct 2020 17:16:13 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2479"; mail-complaints-to="usenet@ciao.gmane.io" To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Oct 10 17:17:10 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 1kRGcP-0000WV-EH for guile-user@m.gmane-mx.org; Sat, 10 Oct 2020 17:17:09 +0200 Original-Received: from localhost ([::1]:42306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRGcO-0005oA-A3 for guile-user@m.gmane-mx.org; Sat, 10 Oct 2020 11:17:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRGbo-0005ni-7F for guile-user@gnu.org; Sat, 10 Oct 2020 11:16:32 -0400 Original-Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:42659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRGbm-0006kM-Lr for guile-user@gnu.org; Sat, 10 Oct 2020 11:16:31 -0400 Original-Received: by mail-wr1-x42f.google.com with SMTP id e18so13381484wrw.9 for ; Sat, 10 Oct 2020 08:16:27 -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=azoHXacCLqofbN5n/osVkXr0QNtl3terJsZA/igYA3U=; b=I38zwdwlnA4KSDgqYiO/Ao09zbht71vpjsDcxI2spVdOAiLOBzgRtvo8B6YoNcgFyp ZvrOia4DgHo8c0auH/qEuRyVWE3MgiKmti+ArG3xU42ccbj7ahaPD6kqMT7QCaKvvrOy 2Uy20tjMBonbUEyz0EaVIRdWCYszYov87Da0onSNNisx9bkSNNlF0hunuuRjkfVCqUJE coy3HVZFe4ddzFghwFJp/SAZSA93mSKrKh312wduHOrh3z2wqjZP3uLYZ96G+qqDsjxj jRbstmO5xTZf1x0D5ZoiiTL4vjR9Ya7bnUroETqEgmC7I8qT2eCEXvqDJcrkCyLCMuxQ BLew== 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=azoHXacCLqofbN5n/osVkXr0QNtl3terJsZA/igYA3U=; b=L1J+aO9Jrrszx3/M/3i5BZ8rGmxFQcFqoA9C5BPbweeBP26lPRM1JbRFsgtvDK7rjV oq03TNhJQkChwMOrax09XOjSwCzK3A3GUWYnXUESd74IIPBBN/FWZw9cDWGFjX+qF1oM 5idzKwRnCpdINlkJ5mpAsgdR6HiPEJEWy4eDnYTMhaNtrZCMNnQpArn2dyrQWdw74Lyb 76Vfn8yMp7/gECbhmmI9yYw1go8KdUQPUZgmH77Ps4W4YMUlFH7zxPsXebnfuuWBt0kz N0tmTln3lrY+gBpL3lJERxs6L5BBuOfTKWJGZLkyURBNZyrpGTRp3tO8ync+zsas+daG Kglg== X-Gm-Message-State: AOAM530R0viO/VoDpJCUtM3L6WNEmp98wB1DgEtns9k1sywA3XdyqIHZ HSZRvPI4p1eIs5uvyzOz8J2+WpLLzcHsyy3H+eRHeh4uI+0= X-Google-Smtp-Source: ABdhPJyRcdOI+clbTJ9OPJbTrBbsqe7aUE7N8zz/VwW0VC5jSZ6IeUv6AMtnl/ETGFfSrJuuasUdBp8S1p4qHT9INp4= X-Received: by 2002:adf:ab50:: with SMTP id r16mr12677498wrc.235.1602342985123; Sat, 10 Oct 2020 08:16:25 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=stefan.itampe@gmail.com; helo=mail-wr1-x42f.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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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:16973 Archived-At: Dear all, Consider the following code (define (f x) (let lp ((i 0) (s 0)) (if (< i (len x)) (lp (+ i 1) (+ (get x i) s)) s))) Not an uncommon code. The problem is you should be able speed up the loop if len and get is generalized procedures by doing the dispatch once like this (define (f x) (let ((-len (find-dispatch len x)) (-get (find-dispatch get x))) (let lp ((i 0) (s 0)) (if (< i (-len x)) (lp (+ i 1) (+ (-get x i) s)) s)))) The question is if we have such an interface or similar or if we should request that we get such a feature from the guile overlords. Regards Stefan