Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding a couple of benchmarks with plotting code? #12

Open
jimhester opened this issue Feb 16, 2021 · 2 comments
Open

Consider adding a couple of benchmarks with plotting code? #12

jimhester opened this issue Feb 16, 2021 · 2 comments

Comments

@jimhester
Copy link

As one of the primary use cases of R is plotting I think having a benchmark that measures this might be useful.

It is also is the type of code (a lot of single calls) that compilers might not be intrinsically that great at, so it might be worth investigating strategies to improve performance.

Ideally we would have a base R plot, a lattice plot and a ggplot2 plot, but as the current benchmarks only seem to use packages shipped in the main R distribution we might have to settle for only base R plotting for now.

I would be happy to write some simple code and open a PR if you would be interested.

@o-
Copy link
Contributor

o- commented Feb 16, 2021

That would be great. Currently all our benchmarks run without dependencies. But maybe it is about time to drop that limitation. We can just pre-install the dependencies in our benchmark-container job.

The whole setup for running the benchmarks is honestly quite convoluted. If you have a benchmark, I can add it to the suite.

@jimhester
Copy link
Author

jimhester commented Feb 16, 2021

Here is some basic plotting code for all three types. They all use the diamonds data which is part of the ggplot2 package.

## ggplot2 plot
library(ggplot2)

p <- ggplot(diamonds) + geom_point(aes(carat, price, color = cut)) + facet_wrap(vars(color))

ggsave(p, filename = "ggplot.png")

## base R plot - this doesn't currently do any facetting / lattices, but I could probably do so if we want.
png("base.png")
plot(diamonds$carat, diamonds$price, col = diamonds$cut, pch=19)
dev.off()

## Lattice plot
library(lattice)
png("lattice.png")
xyplot(carat ~ price | color, group = cut, data = diamonds, pch = 19)
dev.off()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants