diff options
author | Dan McGee <dan@archlinux.org> | 2013-11-27 17:49:58 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-11-27 17:53:37 -0500 |
commit | 9adc2e53124daa6d13090166830396ffff9013d3 (patch) | |
tree | 37a7eea45098117216e4e708fa05f011e83b3821 /templates/mirrors | |
parent | 954b61ee3a0760990f8e17d7d692f3cabd949f9f (diff) |
Stop using Django-provided floatformat template tagrelease_2013-11-30
It turns out this is a HUGE part of our slow mirror status template
rendering, due to the internal workings. Everything is converted to a
Python decimal object which is way slower than just staying in native
floating point. Given we are always dealing with floats when we need to
do our formatting, a home-rolled template tag can accomplish this much
faster.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'templates/mirrors')
-rw-r--r-- | templates/mirrors/mirror_details.html | 6 | ||||
-rw-r--r-- | templates/mirrors/mirrorlist_status.txt | 4 | ||||
-rw-r--r-- | templates/mirrors/status_table.html | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html index f2ffce20..e1962b85 100644 --- a/templates/mirrors/mirror_details.html +++ b/templates/mirrors/mirror_details.html @@ -110,9 +110,9 @@ <td>{{ m_url.last_sync|date:'Y-m-d H:i'|default:'unknown' }}</td> <td>{{ m_url.completion_pct|percentage:1 }}</td> <td>{{ m_url.delay|duration|default:'unknown' }}</td> - <td>{{ m_url.duration_avg|floatformat:2 }}</td> - <td>{{ m_url.duration_stddev|floatformat:2 }}</td> - <td>{{ m_url.score|floatformat:1|default:'∞' }}</td> + <td>{{ m_url.duration_avg|floatvalue:2 }}</td> + <td>{{ m_url.duration_stddev|floatvalue:2 }}</td> + <td>{{ m_url.score|floatvalue:1|default:'∞' }}</td> </tr> {% endfor %} </tbody> diff --git a/templates/mirrors/mirrorlist_status.txt b/templates/mirrors/mirrorlist_status.txt index 575d19f7..c69075a3 100644 --- a/templates/mirrors/mirrorlist_status.txt +++ b/templates/mirrors/mirrorlist_status.txt @@ -1,4 +1,4 @@ -{% comment %} +{% load mirror_status %}{% comment %} Yes, ugly templates are ugly, but in order to keep line breaks where we want them, sacrifices have to be made. If editing this template, it is easiest to forget about where line breaks are happening until you are done getting the @@ -9,6 +9,6 @@ content right, and then go back later to fix it all up. ## Generated on {% now "Y-m-d" %} ## {% for mirror_url in mirror_urls %} -## Score: {{ mirror_url.score|floatformat:1|default:'unknown' }}, {{ mirror_url.country.name|default:'Worldwide' }} +## Score: {{ mirror_url.score|floatvalue:1|default:'unknown' }}, {{ mirror_url.country.name|default:'Worldwide' }} #Server = {{ mirror_url.url}}$repo/os/$arch{% endfor %} {% endautoescape %} diff --git a/templates/mirrors/status_table.html b/templates/mirrors/status_table.html index 6fc07a31..00b9c1df 100644 --- a/templates/mirrors/status_table.html +++ b/templates/mirrors/status_table.html @@ -20,9 +20,9 @@ <td class="country">{% country_flag m_url.country %}{{ m_url.country.name }}</td> <td>{{ m_url.completion_pct|percentage:1 }}</td> <td>{{ m_url.delay|duration|default:'unknown' }}</td> - <td>{{ m_url.duration_avg|floatformat:2 }}</td> - <td>{{ m_url.duration_stddev|floatformat:2 }}</td> - <td>{{ m_url.score|floatformat:1|default:'∞' }}</td> + <td>{{ m_url.duration_avg|floatvalue:2 }}</td> + <td>{{ m_url.duration_stddev|floatvalue:2 }}</td> + <td>{{ m_url.score|floatvalue:1|default:'∞' }}</td> </tr>{% endfor %} </tbody> </table> |