Title: Provide a way to reset state/caches at every loop · Issue #304 · phpbench/phpbench · GitHub
Open Graph Title: Provide a way to reset state/caches at every loop · Issue #304 · phpbench/phpbench
X Title: Provide a way to reset state/caches at every loop · Issue #304 · phpbench/phpbench
Description: As of today's twitter thread and related example, it is currently not supported to run benchmarks and reset state at each execution of the benchmark methods. Basically: class MyBench { public function __construct() { $this->foo = new Foo...
Open Graph Description: As of today's twitter thread and related example, it is currently not supported to run benchmarks and reset state at each execution of the benchmark methods. Basically: class MyBench { public funct...
X Description: As of today's twitter thread and related example, it is currently not supported to run benchmarks and reset state at each execution of the benchmark methods. Basically: class MyBench { public f...
Opengraph URL: https://github.com/phpbench/phpbench/issues/304
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Provide a way to reset state/caches at every loop","articleBody":"As of today's [twitter thread](https://twitter.com/Ocramius/status/691293008428429313) and related [example](https://gist.github.com/Ocramius/c495f7104ab5881072ac), it is currently not supported to run benchmarks and reset state at each execution of the benchmark methods.\n\nBasically:\n\n``` php\nclass MyBench\n{\n public function __construct()\n {\n $this->foo = new Foo();\n }\n public function benchFoo()\n {\n $this->foo->reset(); // \u003c- should not be included in benchmark measurement\n $this->foo->doFoo();\n }\n}\n```\n\nA workaround (for now), is to ensure immutability by de-referencing the system under bench:\n\n``` php\nclass MyBench\n{\n public function __construct()\n {\n $this->foo = new Foo();\n }\n public function benchFoo()\n {\n $foo = clone $this->foo; // \u003c- still some overhead\n\n $foo->doFoo();\n }\n}\n```\n\nThis needs some research, but it may be possible to have a separate `resetInstance` method (or such) on the benchmark, that can be measured and excluded from the output measurements.\n","author":{"url":"https://github.com/Ocramius","@type":"Person","name":"Ocramius"},"datePublished":"2016-01-24T17:34:32Z","url":"https://github.com/phpbench/phpbench/issues/304"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:aa48b7ad-69d6-07cd-8e56-5fb575ed21bc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E770:1453CC:FA2CB:15BD81:6B04640A |
| html-safe-nonce | ee1c7497a33a0e19c2dff1665ede02da4593095877625b2341cad120c38dcc49 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzcwOjE0NTNDQzpGQTJDQjoxNUJEODE6NkIwNDY0MEEiLCJ2aXNpdG9yX2lkIjoiNTA1NjU3MDUxMzgzNzgxMDY5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b3a505e82073edd93b92364a2e50021fa5d6e4ce35c03aefa087282ab3de4e4c |
| hovercard-subject-tag | issue:128412452 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/phpbench/phpbench/304/issue_layout |
| twitter:image | https://opengraph.githubassets.com/76164a40dd13562be5caa14aca43e76e828d33ec6431dc4bf6b88caf9a42eec2/phpbench/phpbench/issues/304 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/76164a40dd13562be5caa14aca43e76e828d33ec6431dc4bf6b88caf9a42eec2/phpbench/phpbench/issues/304 |
| og:image:alt | As of today's twitter thread and related example, it is currently not supported to run benchmarks and reset state at each execution of the benchmark methods. Basically: class MyBench { public funct... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Ocramius |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/phpbench/phpbench git https://github.com/phpbench/phpbench.git |
| octolytics-dimension-user_id | 12785153 |
| octolytics-dimension-user_login | phpbench |
| octolytics-dimension-repository_id | 34982189 |
| octolytics-dimension-repository_nwo | phpbench/phpbench |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 34982189 |
| octolytics-dimension-repository_network_root_nwo | phpbench/phpbench |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width