Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions benchmarks/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"benchmarks.model_benchmarks.model_save_new",
"benchmarks.model_benchmarks.model_save_existing",
"benchmarks.other_benchmarks.raw_sql",
"benchmarks.template_benchmarks.l10n_render",
]

SECRET_KEY = "NOT REALLY SECRET"
Expand Down
Empty file.
40 changes: 40 additions & 0 deletions benchmarks/template_benchmarks/l10n_render/benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os
import sys

from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest
from django.shortcuts import render

from ...utils import bench_setup


def make_request():
environ = {
"PATH_INFO": "/",
"QUERY_STRING": "",
"REQUEST_METHOD": "GET",
"SCRIPT_NAME": "",
"SERVER_NAME": "testserver",
"SERVER_PORT": 80,
"SERVER_PROTOCOL": "HTTP/1.1",
"wsgi.input": sys.stdin,
}

return WSGIRequest(environ)


class L10nRender:
def setup(self):
bench_setup()
settings.USE_I18N = False
settings.USE_L10N = True
settings.INSTALLED_APPS = [
"l10n_render",
"django.contrib.auth",
"django.contrib.contenttypes",
]
self.req_object = make_request()

def time_render(self):
context = {"numbers": range(0, 200)}
render(self.req_object, "list.html", context)
10 changes: 10 additions & 0 deletions benchmarks/template_benchmarks/l10n_render/templates/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head></head>
<body>
<ul>
{% for n in numbers %}
<li>{{ n }}</li>
{% endfor %}
</ul>
</body>
</html>