-
Notifications
You must be signed in to change notification settings - Fork 19
Webpage to display a set of benchmarks from RustPython #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1c503a5
Adds a benchmark page to the website
theangryhobbit 6be1576
Create tabs on benchmakrs page with benchmakrs for each tab
theangryhobbit 038aad6
Add zero folders found check, thus no benchmarks to be displayed
theangryhobbit c47d73b
Update indentation
theangryhobbit f9c5006
Update assets/js/tabs.js based on suggested change
theangryhobbit ef898d2
Update assets/js/tabs.js based on suggested change
theangryhobbit 745041f
Update assets/js/tabs.js based on suggested change
theangryhobbit 372f442
Update assets/js/tabs.js based on suggested change
theangryhobbit 2be423e
Fix indentation based on PR suggestion
theangryhobbit b7003e7
Merge remote-tracking branch 'origin/master'
theangryhobbit d67dbc5
Use more efficient code block and remove the other (based on suggestion)
theangryhobbit aaffc4c
Adds benchmark intro to _config file and updates the UI a bit
theangryhobbit 903a873
Removes the benchmarks from the navbar
theangryhobbit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
layout: default | ||
--- | ||
|
||
<section> | ||
<div class="w-80 m-auto mt-2"> | ||
<div class="d-md-flex"> | ||
<div class="d-sm-none"> | ||
<img class="logo" src="{{site.baseurl}}/assets/img/rust-python-logo.svg" alt="RustPython Logo"> | ||
</div> | ||
<div class="pl-md-2"> | ||
<div class="section-title">RustPython</div> | ||
<div class="title">{{ page.title | escape }}</div> | ||
<small>{{ site.benchmarks-intro }}</small> | ||
theangryhobbit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<div class="w-80 m-auto mt-2"> | ||
<div class="benchmarks-intro"> | ||
{{ content }} | ||
</div> | ||
|
||
{% assign folders = "" | split: ", " %} | ||
{% for image in site.static_files %} | ||
{% if image.path contains 'criterion/' %} | ||
{% assign imagepath = image.path | split: "/" %} | ||
{% for subpath in imagepath %} | ||
{% if forloop.index0 == 3 %} | ||
{% assign folders = folders | append: pathName %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{% assign folders = folders | uniq %} | ||
|
||
<!-- The code block below does exactly the same as the one above, which one is cleaner? --> | ||
<!-- {% 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 %} --> | ||
theangryhobbit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{% if folders.size == 0 %} | ||
<p style="color: red;">There are no benchmarks to be displayed.</p> | ||
<p>This shouldn't be happening, please contact one of the maintainers | ||
through <a href="https://gitter.im/rustpython/Lobby">Gitter</a> to report this problem.</p> | ||
{% else %} | ||
<ul class="tab" data-tab="benchmarks"> | ||
{% for folder in folders %} | ||
<li {% if forloop.index==1 %} class="active" {% endif %}> | ||
<a href="">{{ folder }}</a> | ||
</li> | ||
{% endfor%} | ||
</ul> | ||
<ul class="tab-content" id="benchmarks"> | ||
{% for folder in folders %} | ||
<li {% if forloop.index==1 %} class="active" {% endif %}> | ||
<br> | ||
{% for image in site.static_files %} | ||
{% if image.path contains folder %} | ||
<figure> | ||
<img src="{{ site.baseurl }}{{ image.path }}" alt="image" /> | ||
<figcaption>{{ image.name }}</figcaption> | ||
</figure> | ||
{% endif %} | ||
{% endfor%} | ||
</li> | ||
{% endfor%} | ||
</ul> | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
|
||
{%- include footer.html -%} | ||
|
||
<script src="{{ "/assets/js/tabs.js" | relative_url }}"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const removeActiveClasses = function (ulElement) { | ||
theangryhobbit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const lis = ulElement.querySelectorAll('li'); | ||
Array.prototype.forEach.call(lis, function(li) { | ||
li.classList.remove('active'); | ||
}); | ||
} | ||
|
||
const getChildPosition = function (element) { | ||
theangryhobbit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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'); | ||
} | ||
theangryhobbit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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(); | ||
|
||
liTab = link.parentNode; | ||
ulTab = liTab.parentNode; | ||
position = getChildPosition(liTab); | ||
theangryhobbit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (liTab.className.includes('active')) { | ||
return; | ||
} | ||
|
||
removeActiveClasses(ulTab); | ||
tabContentId = ulTab.getAttribute('data-tab'); | ||
tabContentElement = document.getElementById(tabContentId); | ||
theangryhobbit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
removeActiveClasses(tabContentElement); | ||
|
||
tabContentElement.querySelectorAll('li')[position].classList.add('active'); | ||
liTab.classList.add('active'); | ||
}, false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
layout: benchmarks | ||
title: Benchmarks | ||
--- | ||
|
||
This page displays some benchmarks that determine the performance of RustPython. | ||
|
||
Most of these benchmarks compare RustPython to CPython. | ||
|
||
More information about the benchmarks can be found on [the RustPython GitHub repo](https://github.com/RustPython/RustPython/tree/master/benches). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should hold off on adding this to the main menu.
The main menu should have something like "dashboards", then under it a drop-down where we can list benchmarks, cpython compatibility, what is left (and maybe others).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this, I will edit it. But before I do, I have a question about this:
To what should the "CPython compatibility" and "What's left" options link to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mireille-raad I have moved the link to the benchmarks page to the dashboard for now and removed it from the navbar. Let me know if this is good enough or whether you still want to have a dropdown menu added to the navbar for the dasboard.