Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'level,': 0.07; 'plenty': 0.07; 'slow.': 0.09; 'worse': 0.09; 'cc:addr:python-list': 0.11; 'wrote': 0.14; 'concurrency': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'incorrect': 0.16; 'once.': 0.16; 'program?': 0.16; 'subject:? - ': 0.16; 'subject:Pypy': 0.16; 'subject:threads': 0.16; 'throughput': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'all,': 0.19; 'feb': 0.22; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'java': 0.24; 'cc:2**0': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; '25,': 0.31; 'checked': 0.32; 'running': 0.33; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'subject:?': 0.36; 'too': 0.37; 'two': 0.37; 'performance': 0.37; 'being': 0.38; 'ends': 0.38; 'stopped': 0.38; 'handle': 0.38; 'pm,': 0.38; "couldn't": 0.39; 'guy': 0.60; 'life': 0.66; 'close': 0.67; 'caused': 0.69; 'intelligent': 0.74; '2015': 0.84; 'lighter': 0.84; 'to:none': 0.92; 'subject:Are': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=NTHhJLNko58drLbYhSIffar8u7v7N6dcUxyfSqF4jw0=; b=RscglxAyDuRnMTYf7hkhr4FXibdalR+PucIQdt/+HevcJXTvJbKqnzS3mEjhU+rv9g xG/lyFCAq7d/YZPacOkJWbk0uPy9CEXyUnWsGhkSgF+IB5+KEfYoShkDuhCP/Mail062 iHZUxhjT6r1sMuSFJyviICoa0vboJdju9qNTp8UB2wNqc7HiCeCL+zTkYvbXugCkcdgJ mjH3+d/N4cGEz+C0qYdg7ygVAc9Sscoh1GswVWSDwz0NdJfy0hn9axYX6N2/Auqu5bFI ULVl6L1p4jvtzB2Mrvxp9sIxq+48Ui3B3PGx7nNI6b8MQVFQRYr7pWqwfgTb/PVHvtLY eQ/A== MIME-Version: 1.0 X-Received: by 10.50.4.40 with SMTP id h8mr25357293igh.34.1424843648674; Tue, 24 Feb 2015 21:54:08 -0800 (PST) In-Reply-To: <87pp8ybl14.fsf@elektro.pacujo.net> References: <87fv9xdb22.fsf@jester.gateway.pace.com> <54ea7ff4$0$12983$c3e8da3$5496439d@news.astraweb.com> <87zj85bcyu.fsf@jester.gateway.pace.com> <87lhjpb89i.fsf@jester.gateway.pace.com> <87h9udb1eq.fsf@jester.gateway.pace.com> <87bnkkb22u.fsf@jester.gateway.pace.com> <87lhjnang1.fsf@jester.gateway.pace.com> <87bnkjenpp.fsf@elektro.pacujo.net> <8761aqamss.fsf@jester.gateway.pace.com> <87zj82bm15.fsf@elektro.pacujo.net> <87pp8ybl14.fsf@elektro.pacujo.net> Date: Wed, 25 Feb 2015 16:54:08 +1100 Subject: Re: Are threads bad? - was: Future of Pypy? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424843651 news.xs4all.nl 2917 [2001:888:2000:d::a6]:44352 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86378 On Wed, Feb 25, 2015 at 4:46 PM, Marko Rauhamaa wrote: > Marcos Almeida Azevedo : > >> Synchronized methods in Java really makes programming life simpler. >> But I think it is standard practice to avoid this if there is a >> lighter alternative as synchronized methods are slow. Worse case I >> used double checked locking. > > I have yet to see code whose performance suffers from too much locking. > However, I have seen plenty of code that suffers from anomalies caused > by incorrect locking. Uhh, I have seen *heaps* of code whose performance suffers from too much locking. At the coarsest and least intelligent level, a database program that couldn't handle concurrency at all, so I wrote an application-level semaphore that stopped two people from running it at once. You want to use that program? Ask the other guy to close it. THAT is a performance problem. And there are plenty of narrower cases, where it ends up being a transactions-per-second throughput limiter. ChrisA