Skip to content

String concatenation should be replaced with join() #4

@stoarca

Description

@stoarca

Here are the results of a modified spitfire test (https://code.google.com/p/spitfire/source/browse/trunk/tests/perf/bigtable.py) on my machine using

def run_test(t):
  xhpy.pylib.core.ENABLE_VALIDATION = False
  table = <table/>
  for row in t:
    tr = <tr/>
    for col in row.itervalues():
      tr.appendChild(<td>{col}</td>)
    table.appendChild(tr)
  return str(table)

1000x10 table (the default):

Mako Template                                  23.93 ms
StringIO                                       31.38 ms
cStringIO                                       5.48 ms
list concat                                    11.71 ms
xhpy                                          120.58 ms

10x10000 table:

Mako Template                                 247.07 ms
StringIO                                      310.89 ms
cStringIO                                      57.64 ms
list concat                                    44.02 ms
xhpy                                         5738.22 ms

10x100000 table:

Mako Template                                2393.53 ms
StringIO                                     3110.47 ms
cStringIO                                     558.29 ms
list concat                                   409.80 ms
xhpy                                      1733126.09 ms

While the last one might not be a totally realistic example, the first two are, and 5 seconds is not a reasonable render time. I can submit a pull request if you let me know how to use the pdb within xhpy elements. It skips most things for some reason.

Coincidentally, I think you may have been my frosh leader in 2008. I started working on the same thing for a couple of days before I found yours. Great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions