I'm working on a project that needs to occasionally render very large tables -- I'm picking hundreds of thousands of cells as a test point for trying out back end implementation scalability.
I'm parallelizing some of the rendering through ajax calls that returns large subsets of the rendered cells ("<td class='foo'>content</td>") within a JSON structure. I'm using a short template to render each cell: <td class="score"> {{ datapoint.score }} </td> template = get_template('cell.djhtml') for datapoint in self._iterate_datapoints(): datapoint_cell[datapoint.foo_id][datapoint.bar_id] = template.render(dict(datapoint=datapoint)) If I change the template.render() call to just a "<td class='score'>%s</td>" % datapoint.score, the code is an order of magnitude faster. My assumption (and my reading of the django code I think confirmed) that the template is compiled only once, so I'm ok there. Is this difference surprising or unexpected? Would a single (consolidated) render() be expected to be much faster? (I'm trying to think of a way to refactor it to a single render, but I'm not looking forward to rendering json in a django template) I'm also considering I may just need to return structured json and create the elements manually on the client side -- although if I have to do it that manually, I might as well use interpolation on the backend python without using a template... Oh, and I just tried jinja2 -- it was much closer to interpolation speed. Perhaps that is my best answer. Any thoughts or pointers on my predicament? Thanks! Rich -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cb85b941-964c-46c8-8e84-148fdb6049ca%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.