On Thu, May 16, 2013 at 9:14 AM, Jasper Spaans <spa...@fox-it.com> wrote: > Hi list, > > I was toying around a bit with writing a statistical profiler in python, > and came up with https://gist.github.com/jap/5584946 > > For reference, the main routine is: > > with Profiler() as p: > with ProfilerContext("c1"): > s = "" > for t in range(100000): > with ProfilerContext("c2"): > s = s + "a" > s = s + "b" > print p.get_data()
Also, it's not that string concatenation has poor performance, it has quadratic performance. It's the same as in cpython if you made two references to s, your performance will plummet. (each s + 'a' would do a copy). We simply don't have the refcount hack Please use l.append('a') and later ''.join() _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev