3 ms·
I always thought it was interesting that my modern CPU takes ages to plot 100,000 or so points in R or Python (ggplot2, seaborn, plotnine, etc) and yet somehow
by dcl 2y ago
I always thought it was interesting that my modern CPU takes ages to plot 100,000 or so points in R or Python (ggplot2, seaborn, plotnine, etc) and yet somehow my 486DX 50Mhz could pump out all those pixels to play Doom interactively and smoothly.
- sieste 2y agoThis SO thread [1] analyses how much time ggplot spends on various tasks. Not sure if a better GPU integration to produce the visual output would help speed it up significantly. [1] https://stackoverflow.com/questions/73470828/ggplot2-is-slow-where-is-the-bottleneck https://stackoverflow.com/questions/73470828/ggplot2-is-slow...
- kkoncevicius 2y agoFrom R side i think this is mainly because ggplot2 is really really slow. Base R graphics would plot 100,000 points in about 100 milliseconds. x <- rnorm(100000) plot(x) A quick benchmark with writing to a file: x <- rnorm(100000) system.time({ png("file.png") plot(x) dev.off() }) user system elapsed 0.179 0.002 0.180
- stackedinserter 2y agoNobody cares about optimization for relatively big datasets like million points, maybe it's not a very popular use case. Even libraries that do able to render these datasets, do that incorrectly e.g. skip peaks, show black rectangles instead of showing internal distribution of noisy data, etc. I ended up with writing my own tool that's able to show millions of points and never looked back.