Skip to contentSkip to conversation

Uppercase overrides and parsing speed

PATCH Richard Purdie 6 participants 9 messages Feb 23, 2008 – Feb 27, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

At OEDEM I mentioned that we might have some speed gain if bitbake could more easily tell what constituted an override. All current overrides are lower case and we don't have any in upper case. I tried having bitbake ignore uppercase overrides (things like URI in SRC_URI) and saw a 2.5% increase in parsing speed. A patch for bitbake is appended in case anyone wishes to experiment.

Note it doesn't 100% disambiguate the situation since we have lowercase variables.

Cheers,

Richard

bb/data_smart.py +4 -3
Index: lib/bb/data_smart.py
===================================================================
@@ -156,9 +156,10 @@
         # more cookies for the cookie monster
         if '_' in var:
             override = var[var.rfind('_')+1:]
-            if not self._seen_overrides.has_key(override):
-                self._seen_overrides[override] = Set()
-            self._seen_overrides[override].add( var )
+            if not override.isupper():
+                if not self._seen_overrides.has_key(override):
+                    self._seen_overrides[override] = Set()
+                self._seen_overrides[override].add( var )
 
         # setting var
         self.dict[var]["content"] = value
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard Purdie schreef:

| Hi,
|
| At OEDEM I mentioned that we might have some speed gain if bitbake could
| more easily tell what constituted an override. All current overrides are
| lower case and we don't have any in upper case.

Didn't we also agree that variable names shouldn't include '_' at all?

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFHwHeSMkyGM64RGpERAiHbAJ9uielvYaBj3SADU4wpHc6oXguG6wCeNxRX 6xwioyyoHnNqlTsOzZrdLPo=
=YF7a
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 8 lines · Koen Kooi

Richard Purdie schreef:

| Hi,
|
| At OEDEM I mentioned that we might have some speed gain if bitbake
| could more easily tell what constituted an override. All current
| overrides are lower case and we don't have any in upper case.

Didn't we also agree that variable names shouldn't include '_' at all?

We did, but this patch from Richard improves current situation without doing search/replace on whole metadata and users configs.

Signature · 4 lines
JID: hrw-jabber.org
OpenEmbedded developer/consultant

         Someday I'm gonna die but it won't be from boredom [Pink]
#3 lore raw
In reply to Koen Kooi

Hello,

Quoted 11 lines · On Sat, 23 Feb 2008 20:44:19 +0100 Koen Kooi <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard Purdie schreef:

| Hi,
|
| At OEDEM I mentioned that we might have some speed gain if bitbake

could | more easily tell what constituted an override. All current overrides are | lower case and we don't have any in upper case.

Didn't we also agree that variable names shouldn't include '_' at all?

How is that achievable? LETSUSEITLIKETHIS? Maybe exclude 'A' too? ;-) Isn't there was a hint that using '_' as an override operator is funky?

Quoted 4 lines

regards,

Koen

[]

Signature · 2 lines
Best regards,
 Paul                          mailto:[email protected]
#4 lore raw
Quoted 6 lines · Paul Sokolovsky
Quoted 2 lines · Koen Kooi

Didn't we also agree that variable names shouldn't include '_' at all?

How is that achievable? LETSUSEITLIKETHIS? Maybe exclude 'A' too? ;-)

LETS-USE-IT-LIKE-THIS was one of suggestions.

Signature · 5 lines
JID: hrw-jabber.org
OpenEmbedded developer/consultant

      Ludzie dzielą się na tych, którzy mają coś do powiedzenia
      i na tych, którzy mówią bez przerwy.       [Robert Frost]
#5 lore raw
Quoted 6 lines · Marcin Juszkiewicz
Quoted 2 lines · Paul Sokolovsky

Koen Kooi <[email protected]> wrote:

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Didn't we also agree that variable names shouldn't include '_' at all?

How is that achievable? LETSUSEITLIKETHIS? Maybe exclude 'A' too? ;-)

LETS-USE-IT-LIKE-THIS was one of suggestions.

Oh come on, now - you can't be serious. It's just not difficult enough or arcane enough with any of those choices! We need to insist on this syntax for variables:

LET\'S\ USE\ IT\ LIKE\ THIS

;-) :-P

Didn't there used to be some recommendation for a variable naming convention that encoded the type into the name? Somehow all these restrictions on the use of case and underscores reminds me of that notation -- that idea seems to have faded away (thank goodness for that, too), and I don't think we should let OE go there either. I'd rather take a small performance hit instead of having to remember even more rules about upper/lower case and other naming conventions. I vote to leave well enough alone... JMO.

Mike (mwester)

#8 lore raw
In reply to Paul Sokolovsky
Quoted 5 lines · Paul Sokolovsky
Quoted 1 line · On Sat, 23 Feb 2008 20:44:19 +0100 Koen Kooi <[email protected]>…

Didn't we also agree that variable names shouldn't include '_' at all?

How is that achievable? LETSUSEITLIKETHIS? Maybe exclude 'A' too? ;-) Isn't there was a hint that using '_' as an override operator is funky?

Changing the override operator involves a flag day and is painful, changing the variable names isn't quite as invasive and it would be possible to upgrade to over time.

FWIW, there isn't as much improvement as I'd hoped. I mentioned the benchmark result since I had it and I thought it interesting...

Cheers,

Richard

#6 lore raw
In reply to Marcin Juszkiewicz

Hello,

Quoted 10 lines · On Sat, 23 Feb 2008 22:40:59 +0100 Marcin Juszkiewicz…
Quoted 7 lines · Paul Sokolovsky
Quoted 2 lines · Koen Kooi

Didn't we also agree that variable names shouldn't include '_' at all?

How is that achievable? LETSUSEITLIKETHIS? Maybe exclude 'A' too? ;-)

LETS-USE-IT-LIKE-THIS was one of suggestions.

And still, rethinking the override marker is another choice, with a dot being obvious candidate. Both syntaxes can be made coexist in bitbake for some time, and transition made gradual.

Quoted 5 lines
Signature · 3 lines
-- 
JID: hrw-jabber.org
OpenEmbedded developer/consultant

[]

Signature · 2 lines
Best regards,
 Paul                          mailto:[email protected]
#7 lore raw
Quoted 10 lines · On Saturday 23 February 2008 23:00:31 Paul Sokolovsky wrote:

Hello,

On Sat, 23 Feb 2008 22:40:59 +0100

Quoted 5 lines · Marcin Juszkiewicz
Quoted 4 lines · Paul Sokolovsky
Quoted 2 lines · Koen Kooi

Didn't we also agree that variable names shouldn't include '_' at all?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

How is that achievable? LETSUSEITLIKETHIS? Maybe exclude 'A' too? ;-)

LETS-USE-IT-LIKE-THIS was one of suggestions.

And still, rethinking the override marker is another choice, with a dot being obvious candidate.

Agreed. I like that idea. Richard, is there an obvious reason why we didn't consider this instead?

Signature · 1 line
Dr. Michael 'Mickey' Lauer | IT-Freelancer | http://www.vanille-media.de