Page MenuHomeSealhub

stress.tsx
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

stress.tsx

/* eslint-disable no-constant-condition */
/* eslint-disable no-await-in-loop */
import { TempstreamJSX } from "./index.js";
import { spawnSync } from "child_process";
void (async function () {
console.log("Press enter to start");
spawnSync("read _ ", {
shell: true,
stdio: [0, 1, 2],
});
const value = "b";
const values = "a"
.repeat(100)
.split("")
.map((a) => ({ value: a, label: a }));
const iterations = 1000;
const start_ts = Date.now();
for (let i = 1; i <= iterations; i++) {
await (
<label>
<select>
{values
.sort((v1, v2) => (v1.label > v2.label ? 1 : -1))
.map((v) => (
<option value={v.value} selected={value == v.value}>
{v.label}
</option>
))}
</select>
</label>
);
}
const duration = Date.now() - start_ts;
console.log({ duration });
const start_ts_str = Date.now();
for (let i = 1; i <= iterations; i++) {
`<label>
<select>
${values
.sort((v1, v2) => (v1.label > v2.label ? 1 : -1))
.map(
(v) =>
`<option
value="${v.value}"
selected="${value == v.value}"
>
${v.label}
</option>`
)
.join("")}
</select>
</label>`;
}
const duration_str = Date.now() - start_ts_str;
console.log({ duration_str });
})();

File Metadata

Mime Type
application/javascript
Expires
Fri, Nov 27, 16:11 (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1229057
Default Alt Text
stress.tsx (1 KB)

Event Timeline