2008/10/26 Hanno Schlichting <[EMAIL PROTECTED]>:
> In that case a simple (pseudo code):
>
> text = 'a'
> if isinstance(text, unicode):
>    _write(text)
> else:
>    _write(unicode(text))
>
> should be enough, shouldn't it? Feel free to experiment with using
> __unicode__ instead, but I have a feeling that checking for the
> attribute existence, checking if it is a callable and calling it, is
> more expensive.

Unfortunately, converting to ``unicode`` instead of ``str`` is very
expensive. This will probably change to some extent in Python 3.0.

Checking for a ``__unicode__`` attribute helps some, but it's still
about 15-20% slowdown on the admittedly not very realistic bigtable
benchmark.

I think we need to depart from this idea.

I did refactor the code generation logic to make it easier to test
these things quickly; it's now located in the ``generation`` module.

\malthe

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"z3c.pt" group.
To post to this group, send email to z3c_pt@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/z3c_pt?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to