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: Guile's I/O procedures should *not* do thread synchronization Date: Tue, 08 Apr 2014 22:53:27 +0200 Message-ID: <87eh17a6go.fsf@gnu.org> References: <1395746068-20604-1-git-send-email-dfsr@riseup.net> <87lhvys6ug.fsf@pobox.com> <87vbv1ilzl.fsf_-_@yeeloong.lan> <878urxpds1.fsf@pobox.com> <87r45pht6w.fsf@yeeloong.lan> <87vbv0oibe.fsf@pobox.com> <87y4zjt2gh.fsf@yeeloong.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 1396990448 28201 80.91.229.3 (8 Apr 2014 20:54:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Apr 2014 20:54:08 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 08 22:54:00 2014 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 1WXd1r-0003xb-BB for guile-devel@m.gmane.org; Tue, 08 Apr 2014 22:53:59 +0200 Original-Received: from localhost ([::1]:42794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXd1r-0006ET-0J for guile-devel@m.gmane.org; Tue, 08 Apr 2014 16:53:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXd1j-00067z-JI for guile-devel@gnu.org; Tue, 08 Apr 2014 16:53:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXd1a-0002DO-53 for guile-devel@gnu.org; Tue, 08 Apr 2014 16:53:51 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:44799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXd1Z-0002CO-Vb for guile-devel@gnu.org; Tue, 08 Apr 2014 16:53:42 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WXd1Y-0003lm-3v for guile-devel@gnu.org; Tue, 08 Apr 2014 22:53:40 +0200 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Apr 2014 22:53:40 +0200 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Apr 2014 22:53:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Germinal an 222 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.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:MeGBzqLRGdqaOH6pfDt6L7cRUzI= 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:17042 Archived-At: Mark H Weaver skribis: > Andy Wingo 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 > ======================= Interesting; I didn’t expect such differences between unlocked/locked, and among architectures. Ludo’.