R in the browser, measured
R check
A chart in bio.viz computes no test itself: it asks R. This page asks R for two test results three ways, compares what R in this browser answers with what desktop R answers, and reports what starting R in a browser costs.
With no R attached
The call still answers. A chart would draw, and print this in place of a statistic:
From results shipped with the page
Desktop R (R 4.3.3, survival 3.5.8) worked these out ahead of time, and they are read from a file. No R is loaded to show them.
From R in this browser
The button starts R itself in this page (webR 0.6.0, fetched from its public CDN), installs the survival package, and runs the same two tests on the same two tables. Nothing is fetched until it is pressed, and each time below is counted from the call that needed it.
R has not been started.
Two numbers count as the same when they differ by no more than 1 part in 108 of the larger: eight digits must agree, five more than a chart prints. Desktop R and R in the browser are different versions built by different compilers, so the last digits of a number may differ; both numbers are shown in full, with their difference, so nothing the tolerance lets through is hidden. Text, counts and the shape of each answer must match exactly.
What it took, this time
| Step | Time |
|---|
The first result includes fetching and starting R, installing survival and reading the R source. This page cannot say how many megabytes that took, or whether they came over the network or from this browser's cache: R's files are fetched by a worker, and a page cannot see a worker's requests. The megabytes below were counted from outside the page.
What it costs, as measured
| State | MB | Requests | From network | Seconds |
|---|---|---|---|---|
| Coldfirst visit, nothing cached | 26.22 | 12 | 12 | 3.568 |
| Reloadpage loaded again, files in the browser cache, R starts again | 0.00 | 12 | 1 | 2.143 |
| WarmR already running in the page, a second call | 0.00 | 0 | 0 | 0.004 |
- Recorded on 2 October 2026 in Chromium 149.0.7827.55, headless, on a MacBook Pro (Apple M3 Pro, macOS 14.6); network: Wi-Fi, speed not measured. The browser started on a new, empty browser profile with a disk cache.
- MB is megabytes over the network; From network is how many of the requests were not answered from the browser's cache. Both, and the requests, are counted by the browser itself, through its DevTools protocol, for every request for R's files that the page and R's worker make from the press of the button to the last result. Megabytes are compressed bytes of response bodies as received over the network; response headers are not counted, and a file served from the browser cache counts as zero.
- Seconds are from the call to the first result for cold and reload, which includes starting R, installing survival and reading the R source; and for one repeated rank-sum call for warm.
- Each continuous-integration run measures the same three states on its own machine and attaches them to the run.
- The seconds above depend on the network they were measured on. By arithmetic, not measurement: at 10 megabits a second the cold download alone, 26.2 MB, takes about 21 seconds to arrive.
The data and the R
- Rank-sum test: Alanine Aminotransferase at Week 8, Placebo against Xanomeline High Dose (alt-week-8.csv).
- Log-rank test: days on study with discontinuation as the event, three arms (days-on-study.csv).
- Both tables are cut from the public CDISC Pilot 01 test data published by pharmaverse (Apache-2.0), as vendored by safety.viz. No real participant is described.
- The R both sides run is statistics.R: two wrappers, around
wilcox.testandsurvival::survdiff. The desktop answers are in expected.json, written bytools/r-fixtures.R.