From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: Extremly slow for format & string-join Date: Mon, 01 Apr 2013 12:00:01 +0800 Organization: HFG Message-ID: <1364788801.4639.6.camel@Renee-desktop.suse> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1364788808 12792 80.91.229.3 (1 Apr 2013 04:00:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Apr 2013 04:00:08 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Apr 01 06:00:36 2013 Return-path: Envelope-to: guile-devel@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 1UMVvA-0000TE-7H for guile-devel@m.gmane.org; Mon, 01 Apr 2013 06:00:36 +0200 Original-Received: from localhost ([::1]:33713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMVul-0004q4-NT for guile-devel@m.gmane.org; Mon, 01 Apr 2013 00:00:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMVuh-0004oV-T9 for guile-devel@gnu.org; Mon, 01 Apr 2013 00:00:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMVug-0007xV-Iw for guile-devel@gnu.org; Mon, 01 Apr 2013 00:00:07 -0400 Original-Received: from mail-pd0-f177.google.com ([209.85.192.177]:49231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMVug-0007wj-DH for guile-devel@gnu.org; Mon, 01 Apr 2013 00:00:06 -0400 Original-Received: by mail-pd0-f177.google.com with SMTP id u11so119533pdi.22 for ; Sun, 31 Mar 2013 21:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:subject:from:to:date:organization :content-type:x-mailer:mime-version:content-transfer-encoding; bh=ECLnbPBLAiEWqVy333IQ6Ns4Dq7w/Eper1dOlszk5nU=; b=XlEdrjjiJ1V+pOxJDJEQ5UFZp75+eTt6QNN5mch7OqwG/CkZXjqf4HRarBj4CxXygc CLpa1Yd7UHK31qJXs5wDeys2UBRTloQHjX51ElAt2YM7crxP00+ZP4CHM3x01sWhO5S4 PDQSe7F8tzCJnFCWf83lZS1Mwwgyxuc02pNI1tHB6p3Z8v5KnyFzDh7qIjpvk4sC0xm4 aufYw+TEmiMcGuq8kjqi0/5tKDyE+BDNDdrJf1KAbzt9X5W+WTFOdFLqrJ8tbGDoEYpN kAlsCMRqcl+8M25k8/YqiqzLyCoTWap1nRntBShPC1UuP0rsZOyVWAT4AVTyuNHLwBTd KPsQ== X-Received: by 10.66.234.33 with SMTP id ub1mr16727962pac.29.1364788805018; Sun, 31 Mar 2013 21:00:05 -0700 (PDT) Original-Received: from [147.2.147.112] ([61.14.130.226]) by mx.google.com with ESMTPS id hu2sm12103588pbc.38.2013.03.31.21.00.03 (version=SSLv3 cipher=RC4-SHA bits=128/128); Sun, 31 Mar 2013 21:00:04 -0700 (PDT) X-Mailer: Evolution 3.4.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.192.177 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16079 Archived-At: I've tried to implement a function to mimic string multiply like Python: "asdf" * 10 --------------code---------------- (define (str* str n) (format #f "~{~a~}" (make-list n str))) or (define (str* str n) (string-join (make-list n str) "")) --------------end----------------- Both are very slow when N is large (> 1000000). For 'format': ================profile============== time seconds seconds name 73.90 1089.05 1089.04 length 23.61 347.92 347.92 list-tail 0.78 1473.57 11.46 format:format-work 0.60 8.84 8.84 get-output-string 0.28 4.15 4.15 display =================end================= For 'string-join', is shows that the C implementation of string-join is the bottleneck. I have no time to dig into, just report it. Regards.