Hacker News new | past | comments | ask | show | jobs | submit login

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.



This 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...


From 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


Nobody 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.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: