- Notifications
You must be signed in to change notification settings - Fork5
A Graphic Device That Does Nothing
License
Unknown, MIT licenses found
Licenses found
r-lib/devoid
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
#| include: falseknitr::opts_chunk$set(collapse=TRUE,comment="#>",fig.path="man/figures/README-",out.width="100%")
This package provides a graphic device that does no operations. Thismakes it suitable for benchmarking functions that produce graphics as itremoves the device implementation from the equation. In contrast to thenulldev() function fromR.devices package thisdevice is a true device implementation that simply does nothing ratherthan callingpdf() with a temporary file connection.
You can installdevoid with the remotes package:
# install.packages('pak')pak::pak('r-lib/devoid')
devoid provides a single functionvoid_dev() which is used much likeany other device:
library(devoid)void_dev()plot(1:10,1:10)dev.off()#> quartz_off_screen#> 2
Using it we can now see how much drawing time e.g. the png device isresponsible for:
point_coord<- seq_len(1e4)void_plot<-function() { void_dev() plot(point_coord,point_coord) dev.off()NULL}png_plot<-function() { png(tempfile()) plot(point_coord,point_coord) dev.off()NULL}res<-bench::mark(devoid= void_plot(),png= png_plot(),min_iterations=50)plot(res)
About
A Graphic Device That Does Nothing
Topics
Resources
License
Unknown, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.
