Skip to content

[Bug]: saveRDS being used in reporter creates large reports & bookmark folder #352

@averissimo

Description

@averissimo

What happened?

Problems:

  • Size of report and bookmarks folders is very large on the current implementation of teal_reportable
  • Time it takes to generate the report is affected negatively

This happens due to the way saveRDS saves reference objects (for example: environments), we can indirectly observe this by comparing the space in memory and the estimated size via {lobstr} package

Minimal example:

sample_plot <- function() ggplot2::ggplot(iris) + ggplot2::geom_histogram(ggplot2::aes(x = Sepal.Length), binwidth = .1)

path_bare <- withr::local_tempfile()
obj0 <- sample_plot()
{
  tictoc::tic("With namespace")
  saveRDS(obj0, file = path_bare)
  tictoc::toc()
}

{
  glue::glue("obj0: (obj.si) ", object.size(obj0) |> format(units = "auto")) |> print()
  glue::glue("obj0: (lobstr) ", lobstr::obj_size(obj0) |> format(units = "auto")) |> print()
  glue::glue("obj0: (disk)   ", structure(file.size(path_bare), class = "object_size") |> format(units = "auto")) |> print()
}
#> With namespace: 0.129 sec elapsed
#> obj0: (obj.si) 12.7 Kb
#> obj0: (lobstr) 4.59 MB
#> obj0: (disk)   205 Kb

sessionInfo()

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions