mbalabash/estimo

Consider using Tracium instead of Big Rig

aslushnikov opened this issue · 8 comments

Hi folks!

Big Rig hasn't been updated for a long time. Over the last years, Chrome Traces format has changed quite a bit, so there's no guarantee Big Rig results are sensible/trustworthy (most likely they're not).

Google Lighthouse is one of the projects that parses Chrome Traces correctly. Since there are a few use cases around that rely on Chrome Traces (including "estimo"), we extracted trace-parsing logic from Lighthouse into a standalone library - Tracium.

Consider using Tracium for a much more trustworthy results.

Thanks!

Hi @aslushnikov

we extracted trace-parsing logic from Lighthouse into a standalone library - Tracium.

It's a great news! Thanks for sharing it.
I will test Tracium and prepare to migrate on this lib in few days.

And thanks for your attention to this project 😊.

@mbalabash also, many of the metrics you care about - such as script duration, layout duration and so on, are available with Puppeteer's page.metrics() api - so you might not need to do trace processing altogether.

Consider the following example:

const puppeteer = require('puppeteer');
(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://google.com');
  console.log(await page.metrics());
  await browser.close();
})();

Yields:

{ Timestamp: 2794.932485,
  Documents: 4,
  Frames: 1,
  JSEventListeners: 126,
  Nodes: 333,
  LayoutCount: 8,
  RecalcStyleCount: 20,
  LayoutDuration: 0.033013,
  RecalcStyleDuration: 0.008684,
  ScriptDuration: 0.168618,
  TaskDuration: 0.332174,
  JSHeapUsedSize: 10366872,
  JSHeapTotalSize: 14053376 }

Wow! It's a good new API.

I can add new mode to estimo which will use only puppeteer.
In some cases (including Size Limit) it will be enough and should work faster.

Does ScriptDuration includes time for all events related to Javascript?
Is it possible to see all handled browser events for some metric?

Thanks!

Does ScriptDuration includes time for all events related to Javascript?
Is it possible to see all handled browser events for some metric?

@mbalabash Puppeteer's page.metrics() doesn't rely on chrome traces - instead it is powered by DevTools protocol, using Performance.getMetrics call.

This DevTools protocol method does a pretty good job on instrumenting script execution in Chromium.
If you're into reading chromium code, here's the relevant place.

OK.
I will try to figure this out for a better understanding of how it works.
Thanks for information 👍

ai commented

Wow, it is a very interesting idea. Ping me if you need any help.

I prepared new version with Tracium and Puppeteer.
Now i want to test performance and stability.

I will ping you @ai when it will be ready to release. Also i can help with upgrade it in Size Limit.

V2 uses Tracium for parsing.