unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel@gnu.org
Subject: Re: Guile's I/O procedures should *not* do thread synchronization
Date: Sun, 06 Apr 2014 02:08:14 -0400	[thread overview]
Message-ID: <87y4zjt2gh.fsf@yeeloong.lan> (raw)
In-Reply-To: <87vbv0oibe.fsf@pobox.com> (Andy Wingo's message of "Wed, 26 Mar 2014 20:45:09 +0100")

Andy Wingo <wingo@pobox.com> writes:

>>>> However, if we promise to do thread synchronization, we will condemn
>>>> Guile to forever having dog slow 'read-char', 'peek-char', 'write-char',
>>>> 'get-u8', 'peek-u8', and 'put-u8' operations.
>>>
>>> I think you are wrong about "dog slow".  Uncontended mutexes are fast,
>>
>> I did some benchmarks of 'putchar' vs 'putchar_unlocked' in C, without
>> contention.  I think it's fair to assume that the GCC and GLIBC folks
>> did a reasonably good job of making both of these as fast as they could.
>>
>> With gcc -O2, I tested two variants of this program: one with 'putchar'
>> and one with 'putchar_unlocked'.  On my YeeLoong (mips64el w/ N32 ABI),
>> the 'putchar_unlocked' version is faster by a factor of 26.3.
>
> On my i7-2620M, the difference is only a factor of 3.0.
>
> Now I think I understand your perspective; 26x is terrible.  But surely
> this is an architecture problem, and not a Guile problem?  The world
> will only get more multithreaded, and ignoring that does no one any
> service.

Now that I have access to the GCC Compile Farm, I repeated these
benchmarks on a variety of machines, and here are the results:

Ratio  CPU
=======================
26.3   Loongson 2F
14.0   PowerPC (Power7)
13.7   Loongson 3A
 9.33  ARMv6l
 6.47  UltraSparc IIe
 5.09  AMD Athlon II
 4.27  AMD Opteron
 3.46  Core 2 Duo P8600
=======================

     Mark



  reply	other threads:[~2014-04-06  6:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25 11:14 [PATCH] Add observation that ports are not thread-safe Diogo F. S. Ramos
2014-03-25 14:14 ` Andy Wingo
2014-03-25 17:10   ` Diogo F. S. Ramos
2014-03-25 19:39     ` Andy Wingo
2014-03-25 20:36       ` Diogo F. S. Ramos
2014-04-15 11:24         ` Diogo F. S. Ramos
2014-03-26  5:10   ` Guile's I/O procedures should *not* do thread synchronization Mark H Weaver
2014-03-26  8:25     ` Andy Wingo
2014-03-26 15:32       ` Mark H Weaver
2014-03-26 19:45         ` Andy Wingo
2014-04-06  6:08           ` Mark H Weaver [this message]
2014-04-08 20:53             ` 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=87y4zjt2gh.fsf@yeeloong.lan \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /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).