Title: `@BeforeMethod()` does not get called before each call? · Issue #896 · phpbench/phpbench · GitHub
Open Graph Title: `@BeforeMethod()` does not get called before each call? · Issue #896 · phpbench/phpbench
X Title: `@BeforeMethod()` does not get called before each call? · Issue #896 · phpbench/phpbench
Description: I was working on laminas/laminas-servicemanager#93 today, and noticed that we still have the codebase sprinkled with blocks referencing #304 In fact, #304 has been closed as "old", but still applies today. My assumption was that @BeforeM...
Open Graph Description: I was working on laminas/laminas-servicemanager#93 today, and noticed that we still have the codebase sprinkled with blocks referencing #304 In fact, #304 has been closed as "old", but still applie...
X Description: I was working on laminas/laminas-servicemanager#93 today, and noticed that we still have the codebase sprinkled with blocks referencing #304 In fact, #304 has been closed as "old", but st...
Opengraph URL: https://github.com/phpbench/phpbench/issues/896
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`@BeforeMethod()` does not get called before each call?","articleBody":"I was working on https://github.com/laminas/laminas-servicemanager/pull/93 today, and noticed that we still have the codebase sprinkled with blocks referencing https://github.com/phpbench/phpbench/issues/304\r\n\r\nIn fact, https://github.com/phpbench/phpbench/issues/304 has been closed as \"old\", but still applies today.\r\n\r\nMy assumption was that `@BeforeMethods` would be called before each call to said bench method: doesn't seem to be the case, and that leads to benchmarking warmed up caches too, which is a problem (especially if we're benchmarking said warmup).\r\n\r\nIn following example, I would expect 100 calls to `mySetup()`, but only `10` are occurring:\r\n\r\n```php\r\n/** \r\n * @BeforeMethods\r\n * @Revs(10)\r\n * @Iterations(10)\r\n */ \r\nclass MyBench\r\n{\r\n public function mySetup(): void\r\n {\r\n reset_all_the_things_here();\r\n }\r\n\r\n public function benchSomething(): void\r\n {\r\n // irrelevant\r\n }\r\n}\r\n```\r\n\r\nWhat's the best way forward here? Is a change in `@BeforeMethods` viable? It would change the benchmark results for bench suites I've worked on so far, massively, but it would lead to more honest results.","author":{"url":"https://github.com/Ocramius","@type":"Person","name":"Ocramius"},"datePublished":"2021-07-24T18:49:52Z","url":"https://github.com/phpbench/phpbench/issues/896"}
| 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:7c511645-0486-9d08-e87b-952aa1931aae |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E69C:347215:422F88:5AFEA6:6B045193 |
| html-safe-nonce | 55b2e9b03e25d2e3b90de9794f27d38390c74b768df260776bc55e357473adf3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjlDOjM0NzIxNTo0MjJGODg6NUFGRUE2OjZCMDQ1MTkzIiwidmlzaXRvcl9pZCI6IjgzNDg1NzI1MDcwOTU0NTQwOTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b662fc9eac5e3835fcb614178e0d8ca7cc2538ac5c9ee9db23c08a1b6efe7ee1 |
| hovercard-subject-tag | issue:952128994 |
| 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/896/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f84ce21261a9168066cac40f02efe4bbd5b80e0c3ee83d418caa18af4e6bda0/phpbench/phpbench/issues/896 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f84ce21261a9168066cac40f02efe4bbd5b80e0c3ee83d418caa18af4e6bda0/phpbench/phpbench/issues/896 |
| og:image:alt | I was working on laminas/laminas-servicemanager#93 today, and noticed that we still have the codebase sprinkled with blocks referencing #304 In fact, #304 has been closed as "old", but still applie... |
| 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 | 002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730 |
| 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 | 059f24c781e3a0d7df3f27a97da0e93fab06ae39 |
| 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