[PATCH 14/16] qapi/expr.py: Use tuples instead of lists for static data

John Snow posted 16 patches 5 years, 4 months ago
There is a newer version of this series
[PATCH 14/16] qapi/expr.py: Use tuples instead of lists for static data
Posted by John Snow 5 years, 4 months ago
It is -- maybe -- possibly -- three nanoseconds faster.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/expr.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 2a1f37ca88..69ee9e3f18 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -171,11 +171,11 @@ def check_flags(expr: Expression, info: QAPISourceInfo) -> None:
     :param expr: Expression to validate.
     :param info: QAPI source file information.
     """
-    for key in ['gen', 'success-response']:
+    for key in ('gen', 'success-response'):
         if key in expr and expr[key] is not False:
             raise QAPISemError(
                 info, "flag '%s' may only use false value" % key)
-    for key in ['boxed', 'allow-oob', 'allow-preconfig']:
+    for key in ('boxed', 'allow-oob', 'allow-preconfig'):
         if key in expr and expr[key] is not True:
             raise QAPISemError(
                 info, "flag '%s' may only use true value" % key)
-- 
2.26.2


Re: [PATCH 14/16] qapi/expr.py: Use tuples instead of lists for static data
Posted by Eduardo Habkost 5 years, 4 months ago
On Tue, Sep 22, 2020 at 05:13:11PM -0400, John Snow wrote:
> It is -- maybe -- possibly -- three nanoseconds faster.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo


Re: [PATCH 14/16] qapi/expr.py: Use tuples instead of lists for static data
Posted by Cleber Rosa 5 years, 4 months ago
On Tue, Sep 22, 2020 at 05:13:11PM -0400, John Snow wrote:
> It is -- maybe -- possibly -- three nanoseconds faster.
>

Kevin O'Leary would clearly say here: "stop the madness!" :)

> Signed-off-by: John Snow <jsnow@redhat.com>

Reviewed-by: Cleber Rosa <crosa@redhat.com>
Re: [PATCH 14/16] qapi/expr.py: Use tuples instead of lists for static data
Posted by John Snow 5 years, 4 months ago
On 9/24/20 9:03 PM, Cleber Rosa wrote:
> On Tue, Sep 22, 2020 at 05:13:11PM -0400, John Snow wrote:
>> It is -- maybe -- possibly -- three nanoseconds faster.
>>
> 
> Kevin O'Leary would clearly say here: "stop the madness!" :)
> 
>> Signed-off-by: John Snow <jsnow@redhat.com>
> 
> Reviewed-by: Cleber Rosa <crosa@redhat.com>
> 

I can explain!

When I sat down to write this series, I just "cleaned" in general 
without regard to what was strictly necessary and what wasn't.

Once I had to split them out, brick-by-brick, some things looked much 
more frivolous than others, but I had already written and tested them, so...

Well. There are definitely a few unimportant patches here.

--js