Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions docs/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,15 @@ hr {
.text-muted {
color: var(--bs-gray-500) !important; /* needs important since BS .text-muted also uses important */
}
.form-control,
.form-control:focus {
background-color: var(--bs-gray-800);
color: var(--bs-gray-200);
}
.form-control {
border-color: var(--bs-gray-700);
}
.form-control::placeholder {
color: var(--bs-gray-500);
}
}
3 changes: 3 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ <h1 class="mt-5">Lambda Cold Starts benchmark <br />by <a href="https://maxday.d
❄ Avg Cold Start duration · 💾 Avg Memory Used · ⚡ Avg duration
</span>
</p>
<input type="search" id="runtimeSearch" class="form-control form-control-sm mb-2"
placeholder="Filter runtimes (e.g. python, nodejs24)" aria-label="Filter runtimes" autocomplete="off" />
<hr />
<div id="sampleRuntimeElement" class="runtime">
<span class="badge bg-success"><span class="runtimeName">runtime name</span></span>
Expand All @@ -81,6 +83,7 @@ <h1 class="mt-5">Lambda Cold Starts benchmark <br />by <a href="https://maxday.d
<hr />
</div>
<div id="runtimes"></div>
<p id="noRuntimeMatch" class="text-muted" hidden>No runtime matches</p>
</main>
<footer class="footer">
<div class="container">
Expand Down
30 changes: 30 additions & 0 deletions docs/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const animate = async (dataManager) => {
promiseArray.push(drawLang(i, runtime));
++i;
}
applySearchFilter();
await Promise.all(promiseArray);
} catch (e) {
console.error(e);
Expand Down Expand Up @@ -74,6 +75,31 @@ const getCurrentPackageType = () => {
return "zip";
};

const getSearchTerms = () =>
document
.getElementById("runtimeSearch")
.value.split(",")
.map((term) => term.trim().toLowerCase())
.filter((term) => term.length > 0);

const matchesSearch = (name, terms) =>
terms.length === 0 || terms.some((term) => name.toLowerCase().includes(term));

const applySearchFilter = () => {
const terms = getSearchTerms();
const cards = document.querySelectorAll("#runtimes > .runtime");
let visibleCount = 0;
cards.forEach((card) => {
const visible = matchesSearch(card.dataset.runtimeName, terms);
card.style.display = visible ? "" : "none";
if (visible) {
++visibleCount;
}
});
document.getElementById("noRuntimeMatch").hidden =
cards.length === 0 || visibleCount > 0;
};

const replayAnimation = async (dataManager) => {
document.getElementById("runtimes").innerHTML = "";
await animate(dataManager);
Expand All @@ -89,6 +115,9 @@ const loaded = async (dataManager) => {
setupFilterEvent(".memorySizeBtn", dataManager);
setupFilterEvent(".architectureBtn", dataManager);
setupFilterEvent(".packageTypeBtn", dataManager);
document
.getElementById("runtimeSearch")
.addEventListener("input", applySearchFilter);
document
.getElementById("replayAnimationBtn")
.addEventListener("click", (dataManager) => replayAnimation(dataManager));
Expand Down Expand Up @@ -118,6 +147,7 @@ const drawLang = async (idx, data) => {

const runtimeName = newElement.getElementsByClassName("runtimeName")[0];
runtimeName.innerHTML = `${data.d}`;
newElement.dataset.runtimeName = data.d;

for (let i = 0; i < data.i.length; ++i) {
await sleep(data.i[i]);
Expand Down
Loading