id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,branch,changelog,apichanges,internalchanges 11185,improve speed of TicketQuery for format=table,Christian Boos,,"The `format=table` was added in 0.11 merely as a proof-of-concept to see how Genshi templates could be reused in different contexts, in this case within a WikiMacro. That proved to work well, except for the performance side of things (see e.g. #10879). A query like `[[TicketQuery(status=closed,format=list)]]` on this site (corresponding to [[TicketQuery(status=closed,format=count)]] tickets) would take several seconds to complete successfully, while `[[TicketQuery(status=closed,format=table)]]` fails after several (more) seconds with: {{{ Error: Macro TicketQuery(status=closed,format=table) failed }}} and in the log we see: {{{ [pid 9964 139956728231680] 2013-05-13 18:46:25,397 Trac[formatter] ERROR: Macro TicketQuery(status=closed,format=table) failed: Traceback (most recent call last): File ""/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py"", line 765, in _macro_formatter return macro.ensure_inline(macro.process(args)) File ""/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py"", line 380, in ensure_inline text = _markup_to_unicode(text) File ""/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py"", line 107, in _markup_to_unicode markup = stream.render('xhtml', encoding=None, strip_whitespace=False) File ""/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/core.py"", line 183, in render return encode(generator, method=method, encoding=encoding, out=out) File ""/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/output.py"", line 57, in encode return _encode(''.join(list(iterator))) MemoryError: }}} I think we could approach this particular issue as a way to start a performance enhancement process which will lead to eliminate the Genshi bottleneck, by only generating the relevant data in JSON format (here result rows content), and have some client-side Javascript code for doing the actual rendering (here building the HTML table). This presents a lot of implementation possibilities, but in a first step I believe simple jQuery based building should be good enough, there's probably no need of client-side templating or additional framework. I think that solving #10373 will also be a prerequisite. Once it works for this use case, we could think about how to make the normal `/query` pages benefit from the same performance boost (getting rid of the `query_results.html` template). Then, once we have a robust solution in place, gradually extend that to other ""Genshi-intensive"" places (diffs, source browser, timeline, etc.).",enhancement,new,normal,next-major-releases,query system,1.0-stable,major,,performance genshi jinja2 javascript,,,,,