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.bugs Subject: bug#13188: Whats' the proper senario of par-map? (Was Re: bug#13188: par-map causes VM stack overflow) Date: Thu, 28 Mar 2013 14:44:03 +0100 Message-ID: <87r4izprks.fsf__39592.0399846092$1364478307$gmane$org@gnu.org> References: <1355559152.27310.5.camel@Renee-desktop.suse> <87y5d8rclr.fsf@gnu.org> <1364439334.2730.41.camel@Renee-desktop.suse> <874nfwazc3.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1364478279 1982 80.91.229.3 (28 Mar 2013 13:44:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Mar 2013 13:44:39 +0000 (UTC) Cc: Nala Ginrut , guile-devel@gnu.org, 13188-done@debbugs.gnu.org To: Mark H Weaver Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Mar 28 14:45:06 2013 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 1ULD8Y-0001D3-04 for guile-bugs@m.gmane.org; Thu, 28 Mar 2013 14:45:02 +0100 Original-Received: from localhost ([::1]:50727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULD89-0007nL-VG for guile-bugs@m.gmane.org; Thu, 28 Mar 2013 09:44:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULD86-0007n3-Ok for bug-guile@gnu.org; Thu, 28 Mar 2013 09:44:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULD85-0006bz-Av for bug-guile@gnu.org; Thu, 28 Mar 2013 09:44:34 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULD85-0006bt-7q for bug-guile@gnu.org; Thu, 28 Mar 2013 09:44:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1ULDAU-00067n-O7 for bug-guile@gnu.org; Thu, 28 Mar 2013 09:47:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 28 Mar 2013 13:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13188 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 13188-done@debbugs.gnu.org id=D13188.136447840023500 (code D ref 13188); Thu, 28 Mar 2013 13:47:02 +0000 Original-Received: (at 13188-done) by debbugs.gnu.org; 28 Mar 2013 13:46:40 +0000 Original-Received: from localhost ([127.0.0.1]:49260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ULDA7-00066y-4h for submit@debbugs.gnu.org; Thu, 28 Mar 2013 09:46:39 -0400 Original-Received: from xanadu.aquilenet.fr ([88.191.123.111]:45171) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ULDA3-00066o-9q for 13188-done@debbugs.gnu.org; Thu, 28 Mar 2013 09:46:36 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id BDE298D01; Thu, 28 Mar 2013 14:44:03 +0100 (CET) Original-Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6NaxBGGPvb1p; Thu, 28 Mar 2013 14:44:03 +0100 (CET) Original-Received: from pluto (unknown [193.50.110.140]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 7140B6BBE; Thu, 28 Mar 2013 14:44:03 +0100 (CET) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 8 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 In-Reply-To: <874nfwazc3.fsf@tines.lan> (Mark H. Weaver's message of "Thu, 28 Mar 2013 01:05:32 -0400") User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) 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.x 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:7020 Archived-At: Mark H Weaver skribis: > Nala Ginrut writes: > >> But I'm still puzzled with the performance of par-map: >> --------------------cut------------------- >> scheme@(guile-user)> ,time (define a (map (lambda (x) (expt x 5)) (iota >> 10000))) >> ;; 0.008019s real time, 0.007979s run time. 0.000000s spent in GC. >> scheme@(guile-user)> ,time (define a (par-map (lambda (x) (expt x 5)) >> (iota 10000))) >> ;; 6.596471s real time, 6.579375s run time. 1.513880s spent in GC. >> --------------------end------------------- >> >> So my question is, what's the proper scenario to use par-map? > > It only makes sense to use 'par-map' when the procedure is fairly > expensive to compute. Indeed. > There is inevitably a lot of overhead in creating and joining the > threads. We use a thread pool, so there=E2=80=99s no such cost. But there are other costs. When delimited continuations are used, we=E2=80= =99re on the slow path. Also, Guile=E2=80=99s fat mutexes & co. are terribly inefficient. And finally, there may be contention on the futexes mutex (esp. when the computations is too small.) So yes, there=E2=80=99s room for improvement. Yet, it should be fruitful, provided you use it for reasonably long computations, as Mark outlines. Ludo=E2=80=99.