Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use more efficient code block and remove the other (based on suggestion)
  • Loading branch information
theangryhobbit committed Apr 1, 2021
commit d67dbc52dac555ba57e89f20ef23d9468675fc6e
30 changes: 8 additions & 22 deletions _layouts/benchmarks.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,17 @@
<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 %}
{% 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 %} -->
{% assign folders = folders | uniq %}

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