Skip to content

Instantly share code, notes, and snippets.

@cmdcolin
Last active June 21, 2024 19:47
Show Gist options
  • Save cmdcolin/9d8294ea86ebbae3a0cf1b642c36817d to your computer and use it in GitHub Desktop.
Save cmdcolin/9d8294ea86ebbae3a0cf1b642c36817d to your computer and use it in GitHub Desktop.
#!/bin/bash
# gen_data.sh
# tags.txt is a list of git tags for a repo
cat tags.txt|while read p; do
## visit our specific JBrowse URL containing tag name in URL
echo -n "$p"$'\t'; node get_page_size.js "https://jbrowse.org/code/jb2/$p/?config=test_data%2Fvolvox%2Fconfig.json&session=share-9NPMoB3dtz&password=aCI2W";
done;
const puppeteer = require("puppeteer");
async function run() {
const browser = await puppeteer.launch({
args: ["--no-sandbox", "--disable-setuid-sandbox"],
});
const page = await browser.newPage();
await page.goto(process.argv[2]);
await new Promise((res) => setTimeout(res, 3000));
const perfEntries = JSON.parse(
await page.evaluate(() => JSON.stringify(performance.getEntries())),
);
console.log(
perfEntries
.map((f) => f.transferSize)
.filter((f) => !!f)
.reduce((a, b) => a + b, 0), ## add up all files transferred over network
);
browser.close();
}
run();
library(lubridate)
library(ggplot2)
# total.txt contains three columns: tag name, tag date, and page size, created from the above script
x <- read.csv("total.txt", sep = "\t", header = F)
x$day <- round_date(as.Date(x$V2), unit = "day")
ggplot(x, aes(x = day, y = V3 / 1000000)) +
geom_line() +
expand_limits(y = 0) +
ylab("Bundle size (MB)") +
xlab("Date")
ggsave("out.png")
@cmdcolin
Copy link
Author

cmdcolin commented Jun 21, 2024

out

The major decline in 2022 was the switch from webpack-worker-plugin to native webpack v5 "new Worker" syntax. on-going bundle size reductions often come from lazy loading or optimizing dependencies. note that this is the page size for visiting a specific session (e.g. a page with a GFF track loaded and the track selector loaded). different page states will incur a different size due to differing lazy loaded contents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment