bitty installation snippets examples documentation q&a

snippets

measure performance

          
  • The b.mark() and b.getMarks() methods provide basic timing of named measurements using performance.now() calls.

html

<pre data-r="timeReport"></pre>

javascript

export const b = { init: "timeReport" };

export async function timeReport(_, __, el) {
  b.mark("snippet");
  await b.sleep(100);
  b.mark("snippet");
  await b.sleep(100);
  b.mark("snippet");
  el.innerHTML = b.getMarks("snippet")
    .map((mark) => mark)
    .join("\n");
}