[Buildbot-commits] [buildbot/buildbot] 2ab18d: namespace: convenience class for json like data
GitHub
noreply at github.com
Tue Oct 2 13:27:58 UTC 2012
Branch: refs/heads/master
Home: https://github.com/buildbot/buildbot
Commit: 2ab18d865f06db1b643d5b005eb83a35a6927da4
https://github.com/buildbot/buildbot/commit/2ab18d865f06db1b643d5b005eb83a35a6927da4
Author: Pierre Tardy <pierre.tardy at intel.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/test/__init__.py
A master/buildbot/test/unit/test_util_namespace.py
A master/buildbot/util/namespace.py
Log Message:
-----------
namespace: convenience class for json like data
One thing that is cooler with java-script than in python is that
dictionaries and objects are the same thing. It allows browsing of
complex hierarchical data syntactically easy.
One will always prefer writing:
buildrequest.properties.myprop
rather than
brdict['properties']['myprop']
This class allows such syntax sugar, by converting a dictionary
to something that responds to both object and dictionary duck typing
We don't redo the mistakes of java-script model, and don't allow this
class to be inherited, and forbid to implement any specific method
apart from the '__' prefixed duck-typing
only keys() items() and values() are reserved and cannot be accessed
via object notation. they can only be accessed via dict like
notation
First implementation, that use an internal _dict attribute
test_benchmark1 ...
create + access
pure dict : 0.00572395324707
Namespace as dict : 0.29655623436 ( 5180 %)
Namespace as object: 0.293313026428 ( 5124 %)
access only
pure dict : 0.00226902961731
Namespace as dict : 0.219506025314 ( 9674 %)
Namespace as object: 0.236507892609 ( 10423 %)
[OK]
test_benchmark2 ...
create + access
pure dict : 0.00633692741394
Namespace as dict : 0.345242977142 ( 5448 %)
Namespace as object: 0.35455083847 ( 5594 %)
access only
pure dict : 0.00258111953735
Namespace as dict : 0.259343862534 ( 10047 %)
Namespace as object: 0.266692876816 ( 10332 %)
[OK]
test_benchmark3 ...
create + access
pure dict : 0.0107021331787
Namespace as dict : 3.95416998863 ( 36947 %)
Namespace as object: 4.02670288086 ( 37625 %)
access only
pure dict : 0.00716400146484
Namespace as dict : 3.73691916466 ( 52162 %)
Namespace as object: 3.7946138382 ( 52967 %)
Commit: cf14a297879ca2c83c17a3e14f95ff094e7047c2
https://github.com/buildbot/buildbot/commit/cf14a297879ca2c83c17a3e14f95ff094e7047c2
Author: Pierre Tardy <pierre.tardy at intel.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/util/namespace.py
Log Message:
-----------
_Namespace as a dict subclass implementation
This needs copy of the actually data.
But dict like read access are then native
test_benchmark1 ...
create + access
pure dict : 0.00615882873535
Namespace as dict : 0.456478118896 ( 7411 %)
Namespace as object: 0.478987932205 ( 7777 %)
access only
pure dict : 0.00246000289917
Namespace as dict : 0.00496506690979 ( 201 %)
Namespace as object: 0.0221290588379 ( 899 %)
[OK]
test_benchmark2 ...
create + access
pure dict : 0.00630712509155
Namespace as dict : 0.768087148666 ( 12178 %)
Namespace as object: 0.792205810547 ( 12560 %)
access only
pure dict : 0.00248885154724
Namespace as dict : 0.00506806373596 ( 203 %)
Namespace as object: 0.0225648880005 ( 906 %)
[OK]
test_benchmark3 ...
create + access
pure dict : 0.0112509727478
Namespace as dict : 9.57195401192 ( 85076 %)
Namespace as object: 9.70584011078 ( 86266 %)
access only
pure dict : 0.00751686096191
Namespace as dict : 0.027991771698 ( 372 %)
Namespace as object: 0.168903112411 ( 2246 %)
Signed-off-by: Pierre Tardy <pierre.tardy at intel.com>
Commit: 548849afd3d84ad9e2d546f5eea33fbd6baed493
https://github.com/buildbot/buildbot/commit/548849afd3d84ad9e2d546f5eea33fbd6baed493
Author: Pierre Tardy <pierre.tardy at intel.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/util/namespace.py
Log Message:
-----------
try to avoid data copy. This does not work, as dict is a native
class, and its method cannot be changed.
Commit: d137598c5ea969656d63331fc5f50bc54cb303d0
https://github.com/buildbot/buildbot/commit/d137598c5ea969656d63331fc5f50bc54cb303d0
Author: Pierre Tardy <pierre.tardy at intel.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/util/namespace.py
Log Message:
-----------
Revert "try to avoid data copy. This does not work, as dict is a native"
This reverts commit 68b982561e3442ada73a9d0dbaf5960a43a68764.
Commit: b60e33e989cae55768355b2cf0ece024c0bb4708
https://github.com/buildbot/buildbot/commit/b60e33e989cae55768355b2cf0ece024c0bb4708
Author: Pierre Tardy <pierre.tardy at intel.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/util/namespace.py
Log Message:
-----------
namespace: final implementation
We translate inner dicts on the fly. This is thus
a good compromise
test_benchmark1 ...
create + access
pure dict : 0.00651502609253
Namespace as dict : 0.152539968491 ( 2341 %)
Namespace as object: 0.173326015472 ( 2660 %)
access only
pure dict : 0.00234913825989
Namespace as dict : 0.0270440578461 ( 1151 %)
Namespace as object: 0.0485229492188 ( 2065 %)
[OK]
test_benchmark2 ...
create + access
pure dict : 0.00629901885986
Namespace as dict : 0.31452703476 ( 4993 %)
Namespace as object: 0.336041927338 ( 5334 %)
access only
pure dict : 0.00247311592102
Namespace as dict : 0.154057979584 ( 6229 %)
Namespace as object: 0.179447889328 ( 7255 %)
[OK]
test_benchmark3 ...
create + access
pure dict : 0.0114121437073
Namespace as dict : 0.848978042603 ( 7439 %)
Namespace as object: 1.067289114 ( 9352 %)
access only
pure dict : 0.00813007354736
Namespace as dict : 0.208504915237 ( 2564 %)
Namespace as object: 0.392553091049 ( 4828 %)
Commit: 249732f58a6bf2f825dfea92dc44240a31d24ccf
https://github.com/buildbot/buildbot/commit/249732f58a6bf2f825dfea92dc44240a31d24ccf
Author: Pierre Tardy <pierre.tardy at intel.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/test/unit/test_util_namespace.py
M master/buildbot/util/namespace.py
Log Message:
-----------
more optimization
After reflexion, it looks that we need to optimize read access
time rather than creation time.
Commit: 1a644e892fd62ea16b85a00913cd6b5fb3231af9
https://github.com/buildbot/buildbot/commit/1a644e892fd62ea16b85a00913cd6b5fb3231af9
Author: Pierre Tardy <pierre.tardy at intel.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/test/unit/test_util_namespace.py
Log Message:
-----------
remove the inheritence forbid from the specs
Implementing it will impact performance
http://code.activestate.com/recipes/141933-forbidding-inheritance/
Signed-off-by: Pierre Tardy <pierre.tardy at intel.com>
Commit: ec125d1fc0fb2f36fc94fffebc4d8228164079af
https://github.com/buildbot/buildbot/commit/ec125d1fc0fb2f36fc94fffebc4d8228164079af
Author: Dustin J. Mitchell <dustin at mozilla.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
Changed paths:
M master/buildbot/test/__init__.py
A master/buildbot/test/unit/test_util_namespace.py
A master/buildbot/util/namespace.py
Log Message:
-----------
Merge branch 'yamlconfig' of git://github.com/tardyp/buildbot
Compare: https://github.com/buildbot/buildbot/compare/1fa1c4fc511e...ec125d1fc0fb
More information about the Commits
mailing list