From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: Extremly slow for format & string-join Date: Tue, 02 Apr 2013 17:56:16 +0200 Message-ID: <87d2udx6xr.fsf@gnu.org> References: <1364788801.4639.6.camel@Renee-desktop.suse> <87obdy3aw9.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1364918192 31423 80.91.229.3 (2 Apr 2013 15:56:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Apr 2013 15:56:32 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 02 17:57:00 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 1UN3Zz-0004gx-UL for guile-devel@m.gmane.org; Tue, 02 Apr 2013 17:57:00 +0200 Original-Received: from localhost ([::1]:42704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN3Zb-0006vD-D9 for guile-devel@m.gmane.org; Tue, 02 Apr 2013 11:56:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN3ZW-0006s4-FI for guile-devel@gnu.org; Tue, 02 Apr 2013 11:56:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UN3ZU-0007JI-28 for guile-devel@gnu.org; Tue, 02 Apr 2013 11:56:30 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:34050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN3ZT-0007JC-SD for guile-devel@gnu.org; Tue, 02 Apr 2013 11:56:27 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UN3Zq-0004a9-JM for guile-devel@gnu.org; Tue, 02 Apr 2013 17:56:50 +0200 Original-Received: from 193.50.110.192 ([193.50.110.192]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Apr 2013 17:56:50 +0200 Original-Received: from ludo by 193.50.110.192 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Apr 2013 17:56:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.50.110.192 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 13 Germinal an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ewUTI/L9nGfDcRC/epP2ZgGexn0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:16109 Archived-At: Mark H Weaver skribis: > Indeed, the implementation of 'string-join' was very bad: about O(n^2) [...] > Before: > > scheme@(guile-user)> ,time (define s (string-join (make-list 10000 "test") "-")) > ;; 0.998800s real time, 0.996677s run time. 0.984885s spent in GC. > scheme@(guile-user)> ,time (define s (string-join (make-list 100000 "test") "-")) > ;; 98.006569s real time, 97.817077s run time. 97.795970s spent in GC. > > After: > > scheme@(guile-user)> ,time (define s (string-join (make-list 10000 "test") "-")) > ;; 0.006362s real time, 0.006351s run time. 0.000000s spent in GC. > scheme@(guile-user)> ,time (define s (string-join (make-list 100000 "test") "-")) > ;; 0.028513s real time, 0.028457s run time. 0.022235s spent in GC. > scheme@(guile-user)> ,time (define s (string-join (make-list 1000000 "test") "-")) > ;; 0.303098s real time, 0.302543s run time. 0.289639s spent in GC. > scheme@(guile-user)> ,time (define s (string-join (make-list 10000000 "test") "-")) > ;; 3.288105s real time, 3.281922s run time. 3.174460s spent in GC. Nice! Ludo’.