[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mercurial-devel
Subject:    Re: [PATCH 01 of 10] check-code: add AST check for mutable default argument values
From:       Jun Wu <quark () fb ! com>
Date:       2016-12-30 20:40:24
Message-ID: 1483129955-sup-8579 () x1c
[Download RAW message or body]

I have gone through all the changes and didn't find small functions being
used in tight loops. So the performance concern is less important. I think
we can enable the check.

Excerpts from Jun Wu's message of 2016-12-30 17:29:23 +0000:
> Excerpts from Augie Fackler's message of 2016-12-28 12:18:51 -0500:
> > >  - Slower, extra tests and GCs (especially in a tight loop)
> > Py_None will at worst get decref'd. It's a singleton, so there won't be
> > any extra GC'ing. `is` checks in cpython are extremely fast (they're exact
> > pointer comparisons, so they're bafflingly cheap compared to pretty much
> > any other Python operation).
> 
> It's the empty list or dict getting created and GCed.
> 
> > Ehhh, I'm pretty deeply uncomfortable putting more magic in our AST
> > transformer. I've still got a vision of how we can make some blame
> > improvements and then actually do a one-time conversion of things like
> > string constants and drop the AST mangler.
> 
> How about having an frozenemptydict constant in the codebase and use it as
> default parameter? The idea is to directly make the object immutable,
> without using "workaround"s like "is None" etc.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic