Message167398
| Author |
abael |
| Recipients |
abael, jcea, pitrou |
| Date |
2012年08月04日.08:00:20 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<CAGt6vUfFke4wSe0mTeNmM9wguCa_y6ESzW1UosNL+r_HnKqP-w@mail.gmail.com> |
| In-reply-to |
<1343826295.99.0.343585939153.issue15522@psf.upfronthosting.co.za> |
| Content |
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>
> _______________________________________
> |
| Files |
| File name |
Uploaded |
|
stringjoin.c
|
abael,
2012年08月04日.08:00:20
|
|
History
|
|---|
| 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 |
|