From a974c90dcfd8b48316e9db4c09bb83c9e1a314d4 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Thu, 4 Jul 2013 15:57:05 +0200 Subject: [PATCH 1/3] row speedups --- gluon/dal.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gluon/dal.py b/gluon/dal.py index 11b246d0..ea7b5537 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6869,6 +6869,11 @@ class Row(object): def __getitem__(self, k): key=str(k) + #_extra = self.__dict__.get('_extra', None) + #if _extra: + # v = _extra.get(key, None) + # if v: + # return v if key in self.get('_extra',{}): return self._extra[key] m = REGEX_TABLE_DOT_FIELD.match(key) From a8a10d6d08ba19d5a8cbc5515106b2b50a513950 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Thu, 4 Jul 2013 16:01:28 +0200 Subject: [PATCH 2/3] uncommented faster code --- gluon/dal.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index ea7b5537..15449ba9 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6869,13 +6869,11 @@ class Row(object): def __getitem__(self, k): key=str(k) - #_extra = self.__dict__.get('_extra', None) - #if _extra: - # v = _extra.get(key, None) - # if v: - # return v - if key in self.get('_extra',{}): - return self._extra[key] + _extra = self.__dict__.get('_extra', None) + if _extra: + v = _extra.get(key, None) + if v: + return v m = REGEX_TABLE_DOT_FIELD.match(key) if m: try: From a7021bece21337b39dabd32487d321d862f2b365 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Fri, 5 Jul 2013 02:13:24 -0500 Subject: [PATCH 3/3] speedup in getattr, thanks Michele --- VERSION | 2 +- gluon/dal.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 7252c8ca..6cb48b73 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.07.03.17.15.42 +Version 2.6.0-development+timestamp.2013.07.05.02.12.46 diff --git a/gluon/dal.py b/gluon/dal.py index 15449ba9..f2592868 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6870,7 +6870,7 @@ class Row(object): def __getitem__(self, k): key=str(k) _extra = self.__dict__.get('_extra', None) - if _extra: + if _extra is not None: v = _extra.get(key, None) if v: return v