[IMP] tools.ustr: speed up average call by short-circuiting common cases
[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)

storm-computers/odoo,hip-odoo/odoo,microcom/odoo,ygol/odoo,syci/OCB,storm-computers/odoo,stephen144/odoo,Elico-Corp/odoo_OCB,stephen144/odoo,bplancher/odoo,microcom/odoo,optima-ict/odoo,laslabs/odoo,mkieszek/odoo,hip-odoo/odoo,tvtsoft/odoo8,hip-odoo/odoo,bplancher/odoo,ygol/odoo,dfang/odoo,stephen144/odoo,stephen144/odoo,tvtsoft/odoo8,storm-computers/odoo,alhashash/odoo,Elico-Corp/odoo_OCB,alhashash/odoo,syci/OCB,hip-odoo/odoo,Elico-Corp/odoo_OCB,laslabs/odoo,laslabs/odoo,optima-ict/odoo,optima-ict/odoo,mkieszek/odoo,laslabs/odoo,ygol/odoo,microcom/odoo,stephen144/odoo,stephen144/odoo,alhashash/odoo,Elico-Corp/odoo_OCB,sysadminmatmoz/OCB,laslabs/odoo,tvtsoft/odoo8,Elico-Corp/odoo_OCB,dfang/odoo,sysadminmatmoz/OCB,ygol/odoo,sysadminmatmoz/OCB,dfang/odoo,storm-computers/odoo,dfang/odoo,mkieszek/odoo,alhashash/odoo,ygol/odoo,dfang/odoo,optima-ict/odoo,tvtsoft/odoo8,syci/OCB,microcom/odoo,bplancher/odoo,sysadminmatmoz/OCB,storm-computers/odoo,hip-odoo/odoo,mkieszek/odoo,microcom/odoo,tvtsoft/odoo8,bplancher/odoo,syci/OCB,mkieszek/odoo,syci/OCB,tvtsoft/odoo8,sysadminmatmoz/OCB,dfang/odoo,sysadminmatmoz/OCB,mkieszek/odoo,syci/OCB,storm-computers/odoo,sysadminmatmoz/OCB,optima-ict/odoo,laslabs/odoo,alhashash/odoo,microcom/odoo,optima-ict/odoo,Elico-Corp/odoo_OCB,hip-odoo/odoo,ygol/odoo,ygol/odoo,bplancher/odoo,bplancher/odoo,alhashash/odoo