Skip to content

Commit d67dbc5

Browse files
committedApr 1, 2021
Use more efficient code block and remove the other (based on suggestion)
1 parent b7003e7 commit d67dbc5

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed
 

‎_layouts/benchmarks.html

+8-22
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,17 @@
2121
<div class="benchmarks-intro">
2222
{{ content }}
2323
</div>
24-
24+
2525
{% assign folders = "" | split: ", " %}
26-
{% for image in site.static_files %}
27-
{% if image.path contains 'criterion/' %}
28-
{% assign imagepath = image.path | split: "/" %}
29-
{% for subpath in imagepath %}
30-
{% if forloop.index0 == 3 %}
31-
{% assign folders = folders | append: pathName %}
32-
{% endif %}
33-
{% endfor %}
34-
{% endif %}
35-
{% endfor %}
36-
{% assign folders = folders | uniq %}
37-
38-
<!-- The code block below does exactly the same as the one above, which one is cleaner? -->
39-
<!-- {% assign folders = "" | split: ", " %}
4026
{% for folder in site.static_files %}
41-
{% if folder.path contains 'criterion/' %}
42-
{% assign temp = folder.path | split: 'criterion/' %}
43-
{% assign pathName = temp[1] | split: '/' | first %}
44-
{% assign pathName = pathName | split: ", " %}
45-
{% assign folders = folders | concat: pathName %}
46-
{% endif %}
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 %}
4733
{% endfor%}
48-
{% assign folders = folders | uniq %} -->
34+
{% assign folders = folders | uniq %}
4935

5036
{% if folders.size == 0 %}
5137
<p style="color: red;">There are no benchmarks to be displayed.</p>

0 commit comments

Comments
 (0)
Please sign in to comment.