From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.bugs Subject: bug#12033: closed (Re: bug#12033: format should be faster) Date: Mon, 20 Aug 2012 23:00:24 -0400 Message-ID: References: <878vd9i651.fsf@gnu.org> <1343023866.4060.12.camel@Renee-SUSE.suse> <87boi5gpg0.fsf@gnu.org> <1345517459.5141.62.camel@Renee-SUSE.suse> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1345518053 25755 80.91.229.3 (21 Aug 2012 03:00:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Aug 2012 03:00:53 +0000 (UTC) Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 12033@debbugs.gnu.org To: nalaginrut Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Aug 21 05:00:52 2012 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T3ei4-0005VU-9u for guile-bugs@m.gmane.org; Tue, 21 Aug 2012 05:00:52 +0200 Original-Received: from localhost ([::1]:41143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ei2-0007Qo-T4 for guile-bugs@m.gmane.org; Mon, 20 Aug 2012 23:00:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ei0-0007Qj-3X for bug-guile@gnu.org; Mon, 20 Aug 2012 23:00:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3ehy-0000Yg-Ke for bug-guile@gnu.org; Mon, 20 Aug 2012 23:00:48 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ehy-0000Yc-AN for bug-guile@gnu.org; Mon, 20 Aug 2012 23:00:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T3eiE-0003Ow-9J for bug-guile@gnu.org; Mon, 20 Aug 2012 23:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noah Lavine Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 21 Aug 2012 03:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12033 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 12033-submit@debbugs.gnu.org id=B12033.134551804513051 (code B ref 12033); Tue, 21 Aug 2012 03:01:02 +0000 Original-Received: (at 12033) by debbugs.gnu.org; 21 Aug 2012 03:00:45 +0000 Original-Received: from localhost ([127.0.0.1]:40741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T3ehx-0003OR-1g for submit@debbugs.gnu.org; Mon, 20 Aug 2012 23:00:45 -0400 Original-Received: from mail-ob0-f172.google.com ([209.85.214.172]:43171) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T3eht-0003OH-LP for 12033@debbugs.gnu.org; Mon, 20 Aug 2012 23:00:43 -0400 Original-Received: by obbwc20 with SMTP id wc20so11029284obb.3 for <12033@debbugs.gnu.org>; Mon, 20 Aug 2012 20:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=YWQ/c5PWbEnw9BtKoVdfhfkJ10Zj3BDGtc9NKsH6arI=; b=gp4BDxRTAdA25TWjKuslLsJUAKrsDR18L1PIaeV19qkCNPYANTRvVHSV47vhSUAq5f vgrZxYtIPOQ+gQlgiJK3FviSyMqW8ZSJW9AifYPJkhRdGtpZrTr6MdXqdE0xirUBUdyS qKHnsCyCyGZ6xKO7JxF3s5AD08wDIVk9U8eSQ/KO2vYjeUSYiWVRELE6u9yH6FiqkpUq dN3mx05kQO+vUWdd/5GiURGq6aViwT3K5BaaW34MRNAQFVHAHwMwfApJJAVG2yrI3syM 0YP/mn8YJbx+T6IuoRsw8F6vjfzZVWeyVHBCJ2Q+qtyNS9vq3ef36uIWhHUP5N8+3JTr Qu5A== Original-Received: by 10.60.30.229 with SMTP id v5mr6818119oeh.130.1345518024414; Mon, 20 Aug 2012 20:00:24 -0700 (PDT) Original-Received: by 10.76.167.197 with HTTP; Mon, 20 Aug 2012 20:00:24 -0700 (PDT) In-Reply-To: <1345517459.5141.62.camel@Renee-SUSE.suse> X-Google-Sender-Auth: qoT8qTKc0olFvwt9f8vGizKYtjU X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6496 Archived-At: Hello, > --------------------code------------------- > scheme@(guile-user)> ,profile (let lp ((i 10000)) (if (> i 0) (begin > (format #f "0x~2'0x, 0x~2'0x, 0x~2'0x" i i i) (lp (1- i))))) > % cumulative self > time seconds seconds name > 22.58 0.56 0.23 tilde-dispatch > 12.90 1.00 0.13 format > 12.90 0.13 0.13 number->string > 8.06 0.13 0.08 format:out-char > 4.84 0.80 0.05 format:format-work > --------------------end------------------- > > In this case, we tried "0x~2'0x" and it's so slow that we can't bare it. > i=10000 is fast, but we need (* 600 80000) > And we found that "tilde-dispatch" cost too much. Is there any possible > to optimize it? It seems clear that in this case, Guile "should" know how to dispatch on the format string just once, outside of the loop, instead of doing it in every iteration. What do people think of declaring format as a macro? That wouldn't help instances of format that have a variable format string, but I bet that's a lot less common than this case. Noah