summaryrefslogtreecommitdiff
path: root/addons/analytic_user_function/security
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2015-03-26 19:28:57 +0100
committerOlivier Dony <odo@openerp.com>2015-03-27 14:44:56 +0100
commitd555fdac0c089a3d99497376e818f58c7e38d59c (patch)
treeebcb739da992dd1cd587d8a312d3cbf40f3f2c97 /addons/analytic_user_function/security
parentcd08281979c0d50a0f135ed452d2a15c6bcc3324 (diff)
[IMP] tools.ustr: speed up average call by short-circuiting common cases
Direct type comparison is significantly faster than isinstance/issubclass calls, so it is worth using in a method that is very frequently called. The extra call to getencoding() also causes a significant overhead, so we try to spare it by tring the hint_encoding first. If all fails, the default behavior still applies. Using micro-benchmarks, the execution time of ustr() on an already-unicode string is cut in half (no conversion is needed), and the overhead for converting utf-8 bytestrings is also cut in half (the conversion itself is O(n) on the string length, obviously)
Diffstat (limited to 'addons/analytic_user_function/security')
0 files changed, 0 insertions, 0 deletions