{"id":16572230,"url":"https://github.com/eddelbuettel/rcppgeiger","last_synced_at":"2025-10-09T07:08:34.450Z","repository":{"id":142505192,"uuid":"83680951","full_name":"eddelbuettel/rcppgeiger","owner":"eddelbuettel","description":"Rcpp Bindings to C++14 Micro-Benchmarking Library","archived":false,"fork":false,"pushed_at":"2025-05-05T03:32:30.000Z","size":28,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T07:08:08.296Z","etag":null,"topics":["benchmark-framework","benchmarking","c-plus-plus","c-plus-plus-14","r","r-package"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddelbuettel.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-03-02T13:30:38.000Z","updated_at":"2025-06-18T13:15:38.000Z","dependencies_parsed_at":"2024-04-03T02:30:28.571Z","dependency_job_id":"9d2dda10-20b7-43de-a843-3ce767f853de","html_url":"https://github.com/eddelbuettel/rcppgeiger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eddelbuettel/rcppgeiger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppgeiger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppgeiger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppgeiger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppgeiger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddelbuettel","download_url":"https://codeload.github.com/eddelbuettel/rcppgeiger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppgeiger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000985,"owners_count":26082971,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["benchmark-framework","benchmarking","c-plus-plus","c-plus-plus-14","r","r-package"],"created_at":"2024-10-11T21:26:50.541Z","updated_at":"2025-10-09T07:08:34.445Z","avatar_url":"https://github.com/eddelbuettel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## RcppGeiger: Micro-Benchmarking for R via Rcpp\n\n[![CI](https://github.com/eddelbuettel/rcppgeiger/workflows/ci/badge.svg)](https://github.com/eddelbuettel/rcppgeiger/actions?query=workflow%3Aci)\n\n## About\n\nThis package brings the [geiger](https://github.com/david-grs/geiger) C++14\nmicro-benchmarking library to R.\n\nIt can make use of the PAPI interface via e.g. `libpapi-dev` on Debian or Ubuntu.  The\ndefault is to build without PAPI unless enabled.  We plan to make this an automatic\ndetection via `configure`.\n\nNote that [geiger](https://github.com/david-grs/geiger) does not build on either macOS, \nor non-amd64Linux architectures.\n\n## Examples\n\nIn its first release, RcppGeiger contains two of the examples from geiger:\n\n#### simple\n\nThe fist example contains two simple lambda function with an single operation each.  We\nreplaced the call to `std::rand()` with one to R's RNG:\n\n```c++\n// [[Rcpp::export]]\nvoid simple() {\n\n    geiger::init();\n\n    // A benchmark suite that does only time measurement\n    geiger::suite\u003c\u003e s;\n\n    s.add(\"R::runif\",\n          []() {\n              //std::rand();\n              R::runif(0, RAND_MAX);\n          });\n\n    s.add(\"vector push_back\",\n          []() {\n              std::vector\u003cint\u003e v;\n              v.push_back(1000);\n          });\n\n    // Redirection of each test result to the \"console\" printer\n    s.set_printer\u003cgeiger::printer::console\u003c\u003e\u003e();\n\n    // Run all benchmarks\n    s.run();\n}\n\n```\n\nRunning this from R shows the following outpu on my laptop:\n\n```r\nR\u003e simple()\nTest                    Iterations    ns / iteration\n----------------------------------------------------\nR::runif               109,254,138                 9\nvector push_back        18,143,368                55\nR\u003e \n```\n\n#### walk\n\nThe second example compares a linear walk through a vector with a random walk. We once\nagain replace `std::rand` with `R::runif`.  The example show how calls to the\n`geiger::suite` instance can be chained.\n\n```c++\nstatic const int size = 1024 * 1024 * 16;\nstatic const int batch = 64;\nstatic const int mask = size - 1;\nstatic const int prime = 7919;\nstatic int sum = 0;\n\nauto linear_walk() {\n    std::vector\u003cchar\u003e v(size, 'a');\n\n    return  [v = std::move(v)]() {\n        static std::size_t pos = /*std::rand()*/ static_cast\u003cint\u003e(R::runif(0, RAND_MAX)) \u0026 mask;\n\n        for (int i = 0; i \u003c batch; ++i) {\n            sum += v[pos];\n            pos = (pos + 1) \u0026 mask;\n        }\n    };\n}\n\nauto random_walk() {\n    std::vector\u003cchar\u003e v(size, 'a');\n\n    return  [v = std::move(v)]() {\n        static std::size_t pos = /*std::rand()*/ static_cast\u003cint\u003e(R::runif(0, RAND_MAX)) \u0026 mask;\n\n        for (int i = 0; i \u003c batch; ++i) {\n            sum += v[pos];\n            pos = (pos * prime) \u0026 mask;\n        }\n    };\n}\n\n\n//' @rdname simple\n// [[Rcpp::export]]\nvoid walk() {\n    geiger::init();\n\n#ifdef USE_PAPI\n    geiger::suite\u003cgeiger::cache_profiler\u003e s;\n#else\n    geiger::suite\u003c\u003e s;\n#endif\n\n    s.add(\"linear walk\", linear_walk())\n     .add(\"random walk\", random_walk())\n     .set_printer\u003cgeiger::printer::console\u003c\u003e\u003e()\n     .run(size / batch);\n}\n\n```\n\nIt produces the following output on the laptop:\n\n```r\nR\u003e walk()\nTest               Iterations    ns / iteration\n-----------------------------------------------\nlinear walk           262,144                57\nrandom walk           262,144               800\nR\u003e \n```\n\nOn a server with both PAPI support and an appropriate cpu, we see\n\n```r\nR\u003e walk()\nTest               Iterations    ns / iteration       L1 DCM       L2 DCM       L3 TCM\n--------------------------------------------------------------------------------------\nlinear walk           262,144                78         1.00         0.03         0.03\nrandom walk           262,144               322        63.94        63.48        25.55\nR\u003e \n```\n\n\n### Installation\n\nThe package is not yet on [CRAN](https://cran.r-project.org) and must\nbe installed from the repository.  For now cloning and installing\nlocally may be easiest.  \n\nOf course \n\n```r\nR\u003e remotes::install_github(\"eddelbuettel/rcppgeiger\")\n```\n\nworks as well.\n\n### Status\n\nThe package is pretty new and raw. Expect changes. \n\nThere are several TODO items (such as collecting data and bringing it back to R) which should be listed as well.\n\n### Author\n\nDirk Eddelbuettel \n\n### License\n\nGPL (\u003e= 2)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Frcppgeiger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddelbuettel%2Frcppgeiger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Frcppgeiger/lists"}