From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: 13188-done@debbugs.gnu.org, guile-devel@gnu.org
Subject: Re: 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 [thread overview]
Message-ID: <87r4izprks.fsf@gnu.org> (raw)
In-Reply-To: <874nfwazc3.fsf@tines.lan> (Mark H. Weaver's message of "Thu, 28 Mar 2013 01:05:32 -0400")
Mark H Weaver <mhw@netris.org> skribis:
> Nala Ginrut <nalaginrut@gmail.com> 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’s no such cost.
But there are other costs. When delimited continuations are used, we’re
on the slow path. Also, Guile’s 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’s room for improvement. Yet, it should be fruitful,
provided you use it for reasonably long computations, as Mark outlines.
Ludo’.
next prev parent reply other threads:[~2013-03-28 13:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1355559152.27310.5.camel@Renee-desktop.suse>
[not found] ` <87y5d8rclr.fsf@gnu.org>
2013-03-28 2:55 ` Whats' the proper senario of par-map? (Was Re: bug#13188: par-map causes VM stack overflow) Nala Ginrut
2013-03-28 5:05 ` Mark H Weaver
2013-03-28 13:44 ` Ludovic Courtès [this message]
2013-03-28 18:00 ` Mark H Weaver
2013-03-28 20:07 ` Ludovic Courtès
2013-03-29 2:36 ` Nala Ginrut
2013-03-29 5:49 ` Mark H Weaver
2013-03-29 6:00 ` Extremely high overhead of 'par-map' Mark H Weaver
2013-03-29 20:24 ` Noah Lavine
2013-03-29 20:27 ` Noah Lavine
2013-03-29 23:18 ` Mark H Weaver
2013-03-30 23:37 ` Ludovic Courtès
2013-03-29 16:45 ` Whats' the proper senario of par-map? (Was Re: bug#13188: par-map causes VM stack overflow) Mark H Weaver
2013-04-01 19:10 ` Andy Wingo
2013-03-29 9:52 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r4izprks.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=13188-done@debbugs.gnu.org \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).