Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'linux,': 0.07; 'plenty': 0.07; 'php,': 0.09; 'slow.': 0.09; 'worse': 0.09; 'cc:addr:python- list': 0.11; 'incorrect': 0.16; 'programmers.': 0.16; 'skip:s 280': 0.16; 'subject:? - ': 0.16; 'subject:Pypy': 0.16; 'subject:threads': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'mechanism': 0.19; 'feb': 0.22; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'necessary.': 0.24; 'java': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; '25,': 0.31; 'clever': 0.31; 'checked': 0.32; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'url:listinfo': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'too': 0.37; 'performance': 0.37; 'pm,': 0.38; 'itself': 0.39; 'url:mail': 0.40; 'course': 0.61; 'love': 0.65; 'life': 0.66; 'caused': 0.69; '2015': 0.84; 'lighter': 0.84; '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:to :cc:content-type; bh=ZpBcMBfY9iurXsuzpSJ4Iueb6NSJ8mv9733utMd3Wn4=; b=NGJkVndf3E/jWO8viL6g5cS57F3YAognd9+RpNExx79z68Y1JBqi8u9MYNd994O5mJ u0SAdJr1hC8Bp8wylKHa3oNNBURhXFbl/mTlSgBKkdNDvddkiZjfXaGGKkPHtE4sahA4 pI38jdrNkiMmrIedTR0BP9YdSEizruO0lElUnn5R0zB3B5ndWLnWKL3uvYvS+bwp1B5r 9IkJop7gEq+pRWn+0pUt5KdBqu/Ofhw4IA9Y5hKWLohxH9w/en8UlFFL1J9OMMOn9JYw YFBWvSbIwm61G8B/PpcND88xTflN+pmLJer1FyI9scIHLGQvyypPoHTzq7LD472CYDmf R0kg== MIME-Version: 1.0 X-Received: by 10.180.84.166 with SMTP id a6mr3388451wiz.4.1424843883046; Tue, 24 Feb 2015 21:58:03 -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 13:58:02 +0800 Subject: Re: Are threads bad? - was: Future of Pypy? From: Marcos Almeida Azevedo To: Marko Rauhamaa Content-Type: multipart/alternative; boundary=f46d041827f0826bf8050fe351d7 Cc: python-list@python.org 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: 85 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424843892 news.xs4all.nl 2879 [2001:888:2000:d::a6]:47013 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86379 --f46d041827f0826bf8050fe351d7 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 25, 2015 at 1: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. > > > Of course code with locking is slower than one without. The locking mechanism itself is the overhead. So use it only when necessary. There is a reason why double checked locking was invented by clever programmers. > Marko > -- > https://mail.python.org/mailman/listinfo/python-list > -- Marcos | I love PHP, Linux, and Java --f46d041827f0826bf8050fe351d7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Wed, Feb 25, 2015 at 1:46 PM, Marko Rauhamaa <<= a href=3D"mailto:marko@pacujo.net" target=3D"_blank">marko@pacujo.net&g= t; wrote:
Marcos Almeida Azevedo &= lt;marcos.al.azevedo@gmail.c= om>:

> 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.



Of course code with lock= ing is slower than one without. The locking mechanism itself is the overhea= d.=C2=A0 So use it only when necessary.=C2=A0 There is a reason why double = checked locking was invented by clever programmers.

=C2= =A0
Marko
--
https://mail.python.org/mailman/listinfo/python-list



--
Marcos | I love= PHP, Linux, and Java
--f46d041827f0826bf8050fe351d7--