-
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 all 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 hidden or 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 hidden or 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 hidden or 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,64 @@ | ||
--- | ||
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> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<div class="w-80 m-auto mt-2"> | ||
<div class="benchmarks-intro"> | ||
{{ content }} | ||
</div> | ||
|
||
{% 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 %} | ||
<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 %} style="font-weight: bold;"> | ||
<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 hidden or 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 hidden or 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,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); | ||
}); | ||
}); |
This file contains hidden or 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 hidden or 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 hidden or 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,8 @@ | ||
--- | ||
layout: benchmarks | ||
title: Benchmarks | ||
--- | ||
|
||
This page displays some benchmarks that determine the performance of RustPython. | ||
|
||
Most of these benchmarks compare RustPython to CPython. |
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.
Uh oh!
There was an error while loading. Please reload this page.