Skip to content

Commit

Permalink
Fix the benchmark when we have a real registered factory
Browse files Browse the repository at this point in the history
Any slowdown appears to be small so far.

+------------------------------+----------------+-----------------------------+
| Benchmark                    | 27_master_list | 27_issue51_1                |
+==============================+================+=============================+
| __main__: toExternalObject   | 405 us         | 437 us: 1.08x slower (+8%)  |
+------------------------------+----------------+-----------------------------+
| __main__: fromExternalObject | 1.37 ms        | 1.41 ms: 1.03x slower (+3%) |
+------------------------------+----------------+-----------------------------+
  • Loading branch information
jamadden committed Jul 13, 2018
1 parent 866597b commit b5374d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/nti/externalization/datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,10 @@ def get_object_to_update(self, key, value, registry):
field = self._iface[key]
# XXX: Maybe this should be a string naming a factory we find in the registry?
# Or a string giving the dottedname to a class we resolve at runtime (and reify)
return field.getTaggedValue('__external_factory__')
factory = field.getTaggedValue('__external_factory__')
except KeyError:
return None
pass
return factory

def updateFromExternalObject(self, parsed, *unused_args, **unused_kwargs):
result = AbstractDynamicObjectIO._updateFromExternalObject(self, parsed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def main(runner=None):
obj.the_objects = [DerivedWithOneTextField(text=u"This is some text " + str(i))
for i in range(10)]


if '--profile' in sys.argv:
profile(100, obj)
return
Expand Down

0 comments on commit b5374d3

Please sign in to comment.