diff --git a/asv/benchmark.py b/asv/benchmark.py
index 8ef427488..5a2adfb10 100644
--- a/asv/benchmark.py
+++ b/asv/benchmark.py
@@ -266,6 +266,7 @@ def __init__(self, name, func, attr_sources):
name = name.split('.', 1)[1]
self.name = name
self.func = func
+ self.pretty_name = getattr(func, "pretty_name", name)
self._attr_sources = attr_sources
self._setups = list(_get_all_attrs(attr_sources, 'setup', True))[::-1]
self._teardowns = list(_get_all_attrs(attr_sources, 'teardown', True))
diff --git a/asv/www/graphdisplay.js b/asv/www/graphdisplay.js
index 91b37fc18..81dcdc993 100644
--- a/asv/www/graphdisplay.js
+++ b/asv/www/graphdisplay.js
@@ -225,7 +225,8 @@ $(document).ready(function() {
});
}
- var top = $('
' + parts[parts.length - 1] + '');
+ var name = bm.pretty_name || bm.name || parts[parts.length - 1];
+ var top = $('' + name + '');
stack[stack.length - 1].append(top);
top.tooltip({
diff --git a/docs/source/writing_benchmarks.rst b/docs/source/writing_benchmarks.rst
index 44f613f0b..0128e9197 100644
--- a/docs/source/writing_benchmarks.rst
+++ b/docs/source/writing_benchmarks.rst
@@ -187,6 +187,9 @@ The following attributes are applicable to all benchmark types:
- ``timeout``: The amount of time, in seconds, to give the benchmark
to run before forcibly killing it. Defaults to 60 seconds.
+- ``pretty_name``: If given, used to display the benchmark name instead of the
+ benchmark function name.
+
Parameterized benchmarks
------------------------