tracerbench
tracerbench copied to clipboard
Could not find Paint event in trace after last mark
This issue is not regular, but appear quite often on same HAR file if we have a lot of samples and it cause the whole compare run to fail.
wondering, is a way to enforce paint event inside tracerbench or ignore this assert?
or rerun exact experiment, because it's quite painful to catch this event on attempt №99 (of 100)
looks like closest logic to it landed in https://github.com/TracerBench/tracerbench/pull/200, especially https://github.com/TracerBench/tracerbench/pull/200/files#diff-0f54ca8abebf7489fe5914256d43426b584a7cbca147eeb2bb25c506c62a4299R41
in theory, we could enforce Paint event, like Modernizr do it: https://github.com/Modernizr/Modernizr/blob/master/test/browser/src/mq.js#L29
function enforcePaintEvent() {
const docElem = document.documentElement;
const refNode = docElem.firstElementChild || docElem.firstChild;
const fakeBody = document.createElement('body');
const div = document.createElement('div');
div.id = 'mq-test-1';
div.style.cssText = 'position:absolute;top:-100em';
fakeBody.style.background = 'none';
fakeBody.appendChild(div);
div.innerHTML = '­<style> #mq-test-1 { width: 42px; }</style>';
docElem.insertBefore(fakeBody, refNode);
try {
return div.offsetWidth === 42;
} finally {
fakeBody.removeChild(div);
docElem.removeChild(fakeBody);
}
}
requestAnimationFrame(() => {
enforcePaintEvent();
requestIdleCallback(() => { __tracerbench.stop(); });
});
@lifeart can we observe observe({type: 'largest-contentful-paint', buffered: true})
when using the navigation timing marks? also, you shouldn't need to use both requestAnimationFrame and requestIdleCallback, requestIdleCallback is supposed to come in the idle space after paint already.
We have a todo to add web-vitals metrics, so waiting for them maybe a good idea.
@krisselden I think so, but this code sometimes throw mentioned error:
without paint event fired