Message167398
added my implement( with some enhancement, got better performance, at less
for my apps. ).
test result:
with small chunk of str, got double performanc,
and 111% for big chunks; it
## Util funcion for text definition:
def pf(f,n):
a=time()
for i in xrange(n):
f()
b=time()
print n/(b-a)
#############################################################################
>>> s=['abcd',u'\u548c\u6613\u541b'] * 1000
>>> pf(lambda:''.join(s), 10000)
2289.28293164
>>> pf(lambda:text.join('',s), 10000)
4457.27947763
>>> s=['abcd'*1000,u'\u548c\u6613\u541b'*1000] * 1000
>>> pf(lambda:''.join(s), 100)
15.2374868484
>>> pf(lambda:text.join('',s), 100)
16.939913023
##############################################################################
2012/8/1 Antoine Pitrou <report@bugs.python.org>
>
> Antoine Pitrou added the comment:
>
> Hi, several points:
>
> - Python 2.7 is in bugfix mode; you need to work from the default
> Mercurial branch as explained in http://docs.python.org/devguide/ . In
> practice, this means your patch will target the future Python 3.4, and
> therefore either PyUnicode_Join or _PyBytes_Join.
>
> - please provide an actual patch (a Mercurial diff, probably)
>
> - please provide benchmarks (using e.g. timeit) which demonstrate the
> performance improvement you are proposing
>
> ----------
> nosy: +pitrou
> versions: +Python 3.4 -Python 2.7
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue15522>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2012-08-04 08:00:22 | abael | set | recipients:
+ abael, jcea, pitrou |
2012-08-04 08:00:21 | abael | link | issue15522 messages |
2012-08-04 08:00:20 | abael | create | |
|