diff --git a/_config.yml b/_config.yml index 6d259e7a..12516116 100644 --- a/_config.yml +++ b/_config.yml @@ -30,6 +30,7 @@ gitter: https://gitter.im/rustpython/Lobby show_excerpts: true contributor_excerpt: "" # TODO: write something here, goes right under "Contributors" heading blog-intro: Create an issue if you see something wrong. Edit posts or create new ones via PR on github.com/RustPython/rustpython.github.io +benchmarks-intro: More information about the benchmarks can be found on github.com/RustPython/RustPython navigation: - title: Blog diff --git a/_includes/head.html b/_includes/head.html index f2ec9a4e..8096a5b4 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -7,6 +7,7 @@ + diff --git a/_layouts/benchmarks.html b/_layouts/benchmarks.html new file mode 100644 index 00000000..5302c49c --- /dev/null +++ b/_layouts/benchmarks.html @@ -0,0 +1,64 @@ +--- +layout: default +--- + +
+
+
+
+ +
+
+
RustPython
+
{{ page.title | escape }}
+ {{ site.benchmarks-intro }} +
+
+
+
+ +
+
+ {{ content }} +
+ + {% assign folders = "" | split: ", " %} + {% for folder in site.static_files %} + {% if folder.path contains 'criterion/' %} + {% assign temp = folder.path | split: 'criterion/' %} + {% assign pathName = temp[1] | split: '/' | first %} + {% assign pathName = pathName | split: ", " %} + {% assign folders = folders | concat: pathName %} + {% endif %} + {% endfor%} + {% assign folders = folders | uniq %} + + {% if folders.size == 0 %} +

There are no benchmarks to be displayed.

+

This shouldn't be happening, please contact one of the maintainers + through Gitter to report this problem.

+ {% else %} + + + {% endif %} +
\ No newline at end of file diff --git a/_layouts/default.html b/_layouts/default.html index 58e141b7..d3f87a77 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -15,6 +15,7 @@ {%- include footer.html -%} + diff --git a/assets/js/tabs.js b/assets/js/tabs.js new file mode 100644 index 00000000..05c85e9b --- /dev/null +++ b/assets/js/tabs.js @@ -0,0 +1,45 @@ +function removeActiveClasses(ulElement) { + + const lis = ulElement.querySelectorAll('li'); + Array.prototype.forEach.call(lis, function(li) { + li.classList.remove('active'); + }); +} + +function getChildPosition(element) { + var parent = element.parentNode; + var i = 0; + for (var i = 0; i < parent.children.length; i++) { + if (parent.children[i] === element) { + return i; + } + } + + throw new Error('No parent found'); +} + +window.addEventListener('load', function () { + const tabLinks = document.querySelectorAll('ul.tab li a'); + + Array.prototype.forEach.call(tabLinks, function(link) { + link.addEventListener('click', function (event) { + event.preventDefault(); + + const liTab = link.parentNode; + const ulTab = liTab.parentNode; + const position = getChildPosition(liTab); + if (liTab.className.includes('active')) { + return; + } + + removeActiveClasses(ulTab); + const tabContentId = ulTab.getAttribute('data-tab'); + const tabContentElement = document.getElementById(tabContentId); + + removeActiveClasses(tabContentElement); + + tabContentElement.querySelectorAll('li')[position].classList.add('active'); + liTab.classList.add('active'); + }, false); + }); +}); \ No newline at end of file diff --git a/assets/style.css b/assets/style.css index aeabe70f..eb8fec17 100644 --- a/assets/style.css +++ b/assets/style.css @@ -279,7 +279,7 @@ ul.list-inline { line-height: 1.5em; } -.blog-intro { +.blog-intro, .benchmarks-intro { background-color: #f6f8fa; padding-left: 2em; padding-right: 2em; diff --git a/assets/tabs.css b/assets/tabs.css new file mode 100644 index 00000000..b25e795d --- /dev/null +++ b/assets/tabs.css @@ -0,0 +1,48 @@ +.tab { + display: flex; + flex-wrap: wrap; + margin-left: -20px; + padding: 0; + list-style: none; + position: relative; +} + +.tab > * { + flex: none; + padding-left: 20px; + position: relative; +} + +.tab > * > a { + display: block; + text-align: center; + padding: 9px 20px; + color: #999; + border-bottom: 2px solid transparent; + border-bottom-color: transparent; + font-size: 12px; + text-transform: uppercase; + transition: color .1s ease-in-out; + line-height: 20px; +} + +.tab > .active > a { + color:#222; + border-color: #1e87f0; +} + +.tab li a { + text-decoration: none; + cursor: pointer; +} + +.tab-content{ + padding: 0; +} + +.tab-content li { + display: none; +} +.tab-content li.active { + display: initial; +} \ No newline at end of file diff --git a/benchmarks.markdown b/benchmarks.markdown new file mode 100644 index 00000000..7b7fe774 --- /dev/null +++ b/benchmarks.markdown @@ -0,0 +1,8 @@ +--- +layout: benchmarks +title: Benchmarks +--- + +This page displays some benchmarks that determine the performance of RustPython. + +Most of these benchmarks compare RustPython to CPython.