From owner-freebsd-threads@FreeBSD.ORG Tue Nov 8 09:47:30 2005 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2BC8D16A41F for ; Tue, 8 Nov 2005 09:47:30 +0000 (GMT) (envelope-from s_sourceforge@nedprod.com) Received: from athos.st-andrews.ac.uk (athos.st-and.ac.uk [138.251.61.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9295243D45 for ; Tue, 8 Nov 2005 09:47:28 +0000 (GMT) (envelope-from s_sourceforge@nedprod.com) Received: from kate (res05-ned6.res.st-and.ac.uk [138.251.224.28]) by athos.st-andrews.ac.uk (8.12.9/8.12.9) with SMTP id jA89kueo016720; Tue, 8 Nov 2005 09:46:56 GMT From: "Niall Douglas" To: freebsd-threads@freebsd.org Date: Tue, 08 Nov 2005 09:46:50 -0000 MIME-Version: 1.0 Message-ID: <4370740A.32492.2B723FE@localhost> Priority: normal In-reply-to: <000701c5e432$fb600980$4801a8c0@ws-ew-3.demig.intra> References: <200511071638.12602.nb_root@videotron.ca> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-StAndrews-MailScanner-Information: Please contact the ISP for more information X-StAndrews-MailScanner: No virus detected X-StAndrews-MailScanner-SpamCheck: not spam, SpamAssassin (score=-4.9, required 5, autolearn=not spam, BAYES_00 -4.90) X-StAndrews-MailScanner-From: s_sourceforge@nedprod.com Cc: Subject: RE: c++ with pthread? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2005 09:47:30 -0000 On 8 Nov 2005 at 8:06, Norbert Koch wrote: > > Thanks for your reply! > > > > Performance wise, would you think commoncpp is better with threads than > > directly pthread? > > > > Nicolas. > > Commoncpp tries to be platform-independent. So, no. > What performance are you talking about? Thread creation > may be slower, but context changes are always handled by > pthread. So there would be no difference. > Mutexes and conditionals will be slower too. > I never ran any benchmarks. The implementation of mutexes is the single biggest determinant of heavily multithreaded code. FreeBSD has a very simple memory allocator which always serialises to one thread, resulting in VERY poor performance when you have three or more threads running at once. TnFOX has its own memory allocator (ptmalloc2) as well as its own mutex implementation. I haven't found any system (win32, win64, linux or freebsd) whose native facilities come anywhere close to TnFOX's threading performance. In other words, choosing a good optimised threading library makes ALL the difference to performance. I once again strongly suggest that the FreeBSD memory allocator in libc is replaced with ptmalloc2 (http://www.nedprod.com/programs/Win32/ptmalloc2/ - its MIT licence). Doing this gives a several fold speed increase even in single threaded C++ apps due to the fastbins. Cheers, Niall