{"id":13400646,"url":"https://github.com/rmflight/importedPackageTimings","last_synced_at":"2025-03-14T06:31:49.685Z","repository":{"id":145463112,"uuid":"204230144","full_name":"rmflight/importedPackageTimings","owner":"rmflight","description":"Time combinations of loading packages","archived":false,"fork":false,"pushed_at":"2019-08-27T15:45:25.000Z","size":312,"stargazers_count":5,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T19:25:35.279Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmflight.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-08-25T01:06:50.000Z","updated_at":"2024-02-19T20:50:24.000Z","dependencies_parsed_at":"2023-04-15T11:15:54.382Z","dependency_job_id":null,"html_url":"https://github.com/rmflight/importedPackageTimings","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmflight%2FimportedPackageTimings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmflight%2FimportedPackageTimings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmflight%2FimportedPackageTimings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmflight%2FimportedPackageTimings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmflight","download_url":"https://codeload.github.com/rmflight/importedPackageTimings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243537819,"owners_count":20307098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:54.241Z","updated_at":"2025-03-14T06:31:49.667Z","avatar_url":"https://github.com/rmflight.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n[![Travis build status](https://travis-ci.org/rmflight/importedPackageTimings.svg?branch=master)](https://travis-ci.org/rmflight/importedPackageTimings)\n[![Coverage status](https://codecov.io/gh/rmflight/importedPackageTimings/branch/master/graph/badge.svg)](https://codecov.io/github/rmflight/importedPackageTimings?branch=master)\n\n# importedPackageTimings\n\nWebsite: https://rmflight.github.io/importedPackageTimings\n\nThe goal of `importedPackageTimings` is to help R package developers determine if any of the\nR packages their package depends on (i.e. `imports`) make loading their own package slow.\n\nTo accompmlish this, it uses independent R sessions from the `future` package\nto time how long it takes to load each of the packages listed in the `Imports`\nand `Depends` fields of the package in question. Although it will take a long\ntime because it only uses a single core at a time (the only way I could get\nreliable timings), the times seem to be reliable.\n\n## Installation\n\nCurrently, `importedPackageTimings` only exists on Github, so install it with:\n\n```{r install, eval=FALSE}\nremotes::install_github(\"rmflight/importedPackageTimings\")\n```\n\n## Supported Platforms\n\n**Warning**: This package has only been tested on `Linux`, using the `future`\nand the `multiprocess` backend. I think this should work on `Mac` without any\nissues. I'm not sure which backend should be used on `Windows` such that each\ncall to `furrr::future_map_dbl` is launching a new R sub-process that will be\ncompletely clean. \n\nThe way to know if the code is working correctly is to look at the consistency\nof the `timings` returned from `imported_timings` for a sufficiently long\nimported package. They should be very consistent. If the process is *not* new,\nthen the first timing will be long, and subsequent ones much, much shorter.\n\n## Example\n\nFor example, lets look at a Bioconductor package I've seen take a long time to\nload, `xcms`.\n\n```{r example, eval=FALSE}\n# not run\nlibrary(furrr)\nplan(multiprocess)\nlibrary(importedPackageTimings)\nxcms_time = imported_timings(\"xcms\")\n```\n\nThe package provides two types of timings, the time required for the dependency\nto load (type = `pkg`), and then the time required for the package to load after\nthe dependency (type = `after`).\n\n```{r show_table, results = 'asis'}\ndata(xcms_time)\nknitr::kable(head(dplyr::select(xcms_time, -timings)))\n```\n\nWe can use the `pkg` entries to see which imports actually take a long time\nto load, possibly contributing to the long load time of our package in question.\n\n```{r show_pkg}\nlibrary(ggplot2)\nggplot(dplyr::filter(xcms_time, type %in% \"pkg\"), \n       aes(x = min / 1e9, y = package)) + \n  geom_point()\n```\n\nFrom this plot, we can see that `MSnbase` looks like it is taking the longest to\nload outside of `xcms` itself. \n\nWe can use the `after` entries to see which imports after loading have the\nsmallest time to load our package in question, which also implies they may be the\nculprit causing long load times.\n\n```{r show_after}\nggplot(dplyr::filter(xcms_time, type %in% \"after\", which %in% \"import\"),\n       aes(x = min / 1e9, y = package)) +\n  geom_point()\n```\n\n## License\n\nLicensed under the MIT license, with no warranty.\n\n## Code of Conduct\n\nPlease note that the `importedPackageTimings` project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmflight%2FimportedPackageTimings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmflight%2FimportedPackageTimings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmflight%2FimportedPackageTimings/lists"}