Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33500a9

Browse files
authored
Merge pull request#43 from theangryhobbit/master
Webpage to display a set of benchmarks from RustPython
2 parents03864e8 +903a873 commit33500a9

File tree

8 files changed

+169
-1
lines changed

8 files changed

+169
-1
lines changed

‎_config.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ gitter: https://gitter.im/rustpython/Lobby
3030
show_excerpts:true
3131
contributor_excerpt:""# TODO: write something here, goes right under "Contributors" heading
3232
blog-intro:Create an issue if you see something wrong. Edit posts or create new ones via PR on <a target="_blank" href="https://github.com/RustPython/rustpython.github.io">github.com/RustPython/rustpython.github.io</a>
33+
benchmarks-intro:More information about the benchmarks can be found on <a target="_blank" href="https://github.com/RustPython/RustPython">github.com/RustPython/RustPython</a>
3334

3435
permalink:/blog/:year/:month/:day/:title:output_ext
3536

‎_includes/head.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<!-- google fonts -->
88
<linkdeferasynchref="https://fonts.googleapis.com/css?family=Fira+Sans|Sen:800&display=swap"rel="stylesheet">
99
<!-- stylesheet -->
10+
<linkdeferasyncrel="stylesheet"href="{{"/assets/tabs.css" | relative_url }}">
1011
<linkdeferasyncrel="stylesheet"href="{{"/assets/style.css" | relative_url }}">
1112
<linkdeferasyncrel="stylesheet"href="{{"/assets/media.css" | relative_url }}">
1213
<linkdeferasyncrel="stylesheet"href="{{"/assets/github.css" | relative_url }}">

‎_layouts/benchmarks.html‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
layout: default
3+
---
4+
5+
<section>
6+
<divclass="w-80 m-auto mt-2">
7+
<divclass="d-md-flex">
8+
<divclass="d-sm-none">
9+
<imgclass="logo"src="{{site.baseurl}}/assets/img/rust-python-logo.svg"alt="RustPython Logo">
10+
</div>
11+
<divclass="pl-md-2">
12+
<divclass="section-title">RustPython</div>
13+
<divclass="title">{{ page.title | escape }}</div>
14+
<small>{{ site.benchmarks-intro }}</small>
15+
</div>
16+
</div>
17+
</div>
18+
</section>
19+
20+
<divclass="w-80 m-auto mt-2">
21+
<divclass="benchmarks-intro">
22+
{{ content }}
23+
</div>
24+
25+
{% assign folders = "" | split: ", " %}
26+
{% for folder in site.static_files %}
27+
{% if folder.path contains 'criterion/' %}
28+
{% assign temp = folder.path | split: 'criterion/' %}
29+
{% assign pathName = temp[1] | split: '/' | first %}
30+
{% assign pathName = pathName | split: ", " %}
31+
{% assign folders = folders | concat: pathName %}
32+
{% endif %}
33+
{% endfor%}
34+
{% assign folders = folders | uniq %}
35+
36+
{% if folders.size == 0 %}
37+
<pstyle="color: red;">There are no benchmarks to be displayed.</p>
38+
<p>This shouldn't be happening, please contact one of the maintainers
39+
through<ahref="https://gitter.im/rustpython/Lobby">Gitter</a> to report this problem.</p>
40+
{% else %}
41+
<ulclass="tab"data-tab="benchmarks">
42+
{% for folder in folders %}
43+
<li{%ifforloop.index==1%}class="active"{%endif%}style="font-weight: bold;">
44+
<ahref="">{{ folder }}</a>
45+
</li>
46+
{% endfor%}
47+
</ul>
48+
<ulclass="tab-content"id="benchmarks">
49+
{% for folder in folders %}
50+
<li{%ifforloop.index==1%}class="active"{%endif%}>
51+
<br>
52+
{% for image in site.static_files %}
53+
{% if image.path contains folder %}
54+
<figure>
55+
<imgsrc="{{ site.baseurl }}{{ image.path }}"alt="image"/>
56+
<figcaption>{{ image.name }}</figcaption>
57+
</figure>
58+
{% endif %}
59+
{% endfor%}
60+
</li>
61+
{% endfor%}
62+
</ul>
63+
{% endif %}
64+
</div>

‎_layouts/default.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
{%- include footer.html -%}
1717

18+
<scriptsrc="{{"/assets/js/tabs.js" | relative_url }}"></script>
1819
</body>
1920

2021
</html>

‎assets/js/tabs.js‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
functionremoveActiveClasses(ulElement){
2+
3+
constlis=ulElement.querySelectorAll('li');
4+
Array.prototype.forEach.call(lis,function(li){
5+
li.classList.remove('active');
6+
});
7+
}
8+
9+
functiongetChildPosition(element){
10+
varparent=element.parentNode;
11+
vari=0;
12+
for(vari=0;i<parent.children.length;i++){
13+
if(parent.children[i]===element){
14+
returni;
15+
}
16+
}
17+
18+
thrownewError('No parent found');
19+
}
20+
21+
window.addEventListener('load',function(){
22+
consttabLinks=document.querySelectorAll('ul.tab li a');
23+
24+
Array.prototype.forEach.call(tabLinks,function(link){
25+
link.addEventListener('click',function(event){
26+
event.preventDefault();
27+
28+
constliTab=link.parentNode;
29+
constulTab=liTab.parentNode;
30+
constposition=getChildPosition(liTab);
31+
if(liTab.className.includes('active')){
32+
return;
33+
}
34+
35+
removeActiveClasses(ulTab);
36+
consttabContentId=ulTab.getAttribute('data-tab');
37+
consttabContentElement=document.getElementById(tabContentId);
38+
39+
removeActiveClasses(tabContentElement);
40+
41+
tabContentElement.querySelectorAll('li')[position].classList.add('active');
42+
liTab.classList.add('active');
43+
},false);
44+
});
45+
});

‎assets/style.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ ul.list-inline {
283283
line-height:1.5em;
284284
}
285285

286-
.blog-intro {
286+
.blog-intro, .benchmarks-intro {
287287
background-color:#f6f8fa;
288288
padding-left:2em;
289289
padding-right:2em;

‎assets/tabs.css‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.tab {
2+
display: flex;
3+
flex-wrap: wrap;
4+
margin-left:-20px;
5+
padding:0;
6+
list-style: none;
7+
position: relative;
8+
}
9+
10+
.tab>* {
11+
flex: none;
12+
padding-left:20px;
13+
position: relative;
14+
}
15+
16+
.tab>*>a {
17+
display: block;
18+
text-align: center;
19+
padding:9px20px;
20+
color:#999;
21+
border-bottom:2px solid transparent;
22+
border-bottom-color: transparent;
23+
font-size:12px;
24+
text-transform: uppercase;
25+
transition: color.1s ease-in-out;
26+
line-height:20px;
27+
}
28+
29+
.tab> .active>a {
30+
color:#222;
31+
border-color:#1e87f0;
32+
}
33+
34+
.tablia {
35+
text-decoration: none;
36+
cursor: pointer;
37+
}
38+
39+
.tab-content{
40+
padding:0;
41+
}
42+
43+
.tab-contentli {
44+
display: none;
45+
}
46+
.tab-contentli.active {
47+
display: initial;
48+
}

‎benchmarks.markdown‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
layout:benchmarks
3+
title:Benchmarks
4+
---
5+
6+
This page displays some benchmarks that determine the performance of RustPython.
7+
8+
Most of these benchmarks compare RustPython to CPython.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp