{"action":"created","comment":{"url":"https://api.github.com/repos/hoaproject/Ruler/pulls/comments/81467088","pull_request_review_id":2446547,"id":81467088,"diff_hunk":"@@ -0,0 +1,88 @@\n+<?php\n+\n+/**\n+ * Hoa\n+ *\n+ *\n+ * @license\n+ *\n+ * New BSD License\n+ *\n+ * Copyright © 2007-2016, Hoa community. All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are met:\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in the\n+ *       documentation and/or other materials provided with the distribution.\n+ *     * Neither the name of the Hoa nor the names of its contributors may be\n+ *       used to endorse or promote products derived from this software without\n+ *       specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE\n+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+ * POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+namespace Hoa\\Ruler\\Test\\Benchmark;\n+\n+/**\n+ * @Revs(10)\n+ * @Iterations(10)\n+ * @OutputTimeUnit(\"milliseconds\")\n+ */\n+class RulerBench\n+{\n+    private $ruler;\n+    private $context;\n+\n+    public function setUpAssert()\n+    {\n+        $this->ruler = new \\Hoa\\Ruler\\Ruler();\n+\n+        // 2. Create a context.\n+        $this->context = new \\Hoa\\Ruler\\Context();\n+        $this->context['group']  = 'customer';\n+        $this->context['points'] = function () {\n+            return 42;\n+        };\n+    }\n+\n+    public function provideRules()\n+    {\n+        return [\n+            [\n+                'rule' => 'group in [\"customer\", \"guest\"] and points > 30'\n+            ],\n+            [\n+                'rule' => 'group in [\"customer\", \"guest\"]'\n+            ],\n+            [\n+                'rule' => 'points > 30'\n+            ],\n+        ];\n+    }\n+\n+    /**\n+     * Benchmark parsing with rules of different complexity.\n+     * Executes the method once (warmup) before measuring time.\n+     *\n+     * @Warmup(1)\n+     * @BeforeMethods({\"setUpAssert\"})\n+     * @ParamProviders({\"provideRules\"})\n+     */\n+    public function benchAssert($params)","path":"Test/Benchmark/RulerBench.php","position":84,"original_position":84,"commit_id":"e19cf8450a61be33640acc07f68b4110aa32b036","original_commit_id":"e19cf8450a61be33640acc07f68b4110aa32b036","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"body":"See https://github.com/phpbench/phpbench/pull/449","created_at":"2016-10-02T09:27:09Z","updated_at":"2016-10-02T09:27:09Z","html_url":"https://github.com/hoaproject/Ruler/pull/96#discussion_r81467088","pull_request_url":"https://api.github.com/repos/hoaproject/Ruler/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/hoaproject/Ruler/pulls/comments/81467088"},"html":{"href":"https://github.com/hoaproject/Ruler/pull/96#discussion_r81467088"},"pull_request":{"href":"https://api.github.com/repos/hoaproject/Ruler/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/hoaproject/Ruler/pulls/96","id":86613294,"html_url":"https://github.com/hoaproject/Ruler/pull/96","diff_url":"https://github.com/hoaproject/Ruler/pull/96.diff","patch_url":"https://github.com/hoaproject/Ruler/pull/96.patch","issue_url":"https://api.github.com/repos/hoaproject/Ruler/issues/96","number":96,"state":"open","locked":false,"title":"Example benchmark","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"body":"Just an example benchmark using PHPBench to get things started.\r\n\r\n```\r\n$ phpbench report --uuid=latest --report=hoa\r\nbenchmark: RulerBench, subject: benchAssert\r\n+---------------------------------------------------------------+------+-----+------------+---------+---------+---------+--------+\r\n| params                                                        | revs | its | mem_peak   | best    | mean    | mode    | rstdev |\r\n+---------------------------------------------------------------+------+-----+------------+---------+---------+---------+--------+\r\n| {\"rule\":\"group in [\\\"customer\\\", \\\"guest\\\"] and points > 30\"} | 10   | 10  | 2,249,760b | 3.786ms | 4.724ms | 4.123ms | 15.20% |\r\n| {\"rule\":\"points > 30\"}                                        | 10   | 10  | 2,200,408b | 1.386ms | 1.836ms | 1.909ms | 17.00% |\r\n| {\"rule\":\"group in [\\\"customer\\\", \\\"guest\\\"]\"}                 | 10   | 10  | 2,216,400b | 2.240ms | 2.781ms | 2.715ms | 15.34% |\r\n+---------------------------------------------------------------+------+-----+------------+---------+---------+---------+--------+``\r\n```\r\n","created_at":"2016-09-24T09:38:28Z","updated_at":"2016-10-02T09:27:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59fb1035a4c71562510f94c656f270502a5b2c65","assignee":{"login":"Hywan","id":946104,"avatar_url":"https://avatars.githubusercontent.com/u/946104?v=3","gravatar_id":"","url":"https://api.github.com/users/Hywan","html_url":"https://github.com/Hywan","followers_url":"https://api.github.com/users/Hywan/followers","following_url":"https://api.github.com/users/Hywan/following{/other_user}","gists_url":"https://api.github.com/users/Hywan/gists{/gist_id}","starred_url":"https://api.github.com/users/Hywan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hywan/subscriptions","organizations_url":"https://api.github.com/users/Hywan/orgs","repos_url":"https://api.github.com/users/Hywan/repos","events_url":"https://api.github.com/users/Hywan/events{/privacy}","received_events_url":"https://api.github.com/users/Hywan/received_events","type":"User","site_admin":false},"assignees":[{"login":"Hywan","id":946104,"avatar_url":"https://avatars.githubusercontent.com/u/946104?v=3","gravatar_id":"","url":"https://api.github.com/users/Hywan","html_url":"https://github.com/Hywan","followers_url":"https://api.github.com/users/Hywan/followers","following_url":"https://api.github.com/users/Hywan/following{/other_user}","gists_url":"https://api.github.com/users/Hywan/gists{/gist_id}","starred_url":"https://api.github.com/users/Hywan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hywan/subscriptions","organizations_url":"https://api.github.com/users/Hywan/orgs","repos_url":"https://api.github.com/users/Hywan/repos","events_url":"https://api.github.com/users/Hywan/events{/privacy}","received_events_url":"https://api.github.com/users/Hywan/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hoaproject/Ruler/pulls/96/commits","review_comments_url":"https://api.github.com/repos/hoaproject/Ruler/pulls/96/comments","review_comment_url":"https://api.github.com/repos/hoaproject/Ruler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hoaproject/Ruler/issues/96/comments","statuses_url":"https://api.github.com/repos/hoaproject/Ruler/statuses/e19cf8450a61be33640acc07f68b4110aa32b036","head":{"label":"dantleech:benchmark_example","ref":"benchmark_example","sha":"e19cf8450a61be33640acc07f68b4110aa32b036","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"repo":{"id":69093390,"name":"Ruler","full_name":"dantleech/Ruler","owner":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dantleech/Ruler","description":"The Hoa\\Ruler library.","fork":true,"url":"https://api.github.com/repos/dantleech/Ruler","forks_url":"https://api.github.com/repos/dantleech/Ruler/forks","keys_url":"https://api.github.com/repos/dantleech/Ruler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dantleech/Ruler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dantleech/Ruler/teams","hooks_url":"https://api.github.com/repos/dantleech/Ruler/hooks","issue_events_url":"https://api.github.com/repos/dantleech/Ruler/issues/events{/number}","events_url":"https://api.github.com/repos/dantleech/Ruler/events","assignees_url":"https://api.github.com/repos/dantleech/Ruler/assignees{/user}","branches_url":"https://api.github.com/repos/dantleech/Ruler/branches{/branch}","tags_url":"https://api.github.com/repos/dantleech/Ruler/tags","blobs_url":"https://api.github.com/repos/dantleech/Ruler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dantleech/Ruler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dantleech/Ruler/git/refs{/sha}","trees_url":"https://api.github.com/repos/dantleech/Ruler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dantleech/Ruler/statuses/{sha}","languages_url":"https://api.github.com/repos/dantleech/Ruler/languages","stargazers_url":"https://api.github.com/repos/dantleech/Ruler/stargazers","contributors_url":"https://api.github.com/repos/dantleech/Ruler/contributors","subscribers_url":"https://api.github.com/repos/dantleech/Ruler/subscribers","subscription_url":"https://api.github.com/repos/dantleech/Ruler/subscription","commits_url":"https://api.github.com/repos/dantleech/Ruler/commits{/sha}","git_commits_url":"https://api.github.com/repos/dantleech/Ruler/git/commits{/sha}","comments_url":"https://api.github.com/repos/dantleech/Ruler/comments{/number}","issue_comment_url":"https://api.github.com/repos/dantleech/Ruler/issues/comments{/number}","contents_url":"https://api.github.com/repos/dantleech/Ruler/contents/{+path}","compare_url":"https://api.github.com/repos/dantleech/Ruler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dantleech/Ruler/merges","archive_url":"https://api.github.com/repos/dantleech/Ruler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dantleech/Ruler/downloads","issues_url":"https://api.github.com/repos/dantleech/Ruler/issues{/number}","pulls_url":"https://api.github.com/repos/dantleech/Ruler/pulls{/number}","milestones_url":"https://api.github.com/repos/dantleech/Ruler/milestones{/number}","notifications_url":"https://api.github.com/repos/dantleech/Ruler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dantleech/Ruler/labels{/name}","releases_url":"https://api.github.com/repos/dantleech/Ruler/releases{/id}","deployments_url":"https://api.github.com/repos/dantleech/Ruler/deployments","created_at":"2016-09-24T09:37:16Z","updated_at":"2016-09-24T09:37:17Z","pushed_at":"2016-09-24T09:37:44Z","git_url":"git://github.com/dantleech/Ruler.git","ssh_url":"git@github.com:dantleech/Ruler.git","clone_url":"https://github.com/dantleech/Ruler.git","svn_url":"https://github.com/dantleech/Ruler","homepage":"https://hoa-project.net","size":323,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hoaproject:master","ref":"master","sha":"95e7c66881b2dfffac922798370f00733958f393","user":{"login":"hoaproject","id":1519718,"avatar_url":"https://avatars.githubusercontent.com/u/1519718?v=3","gravatar_id":"","url":"https://api.github.com/users/hoaproject","html_url":"https://github.com/hoaproject","followers_url":"https://api.github.com/users/hoaproject/followers","following_url":"https://api.github.com/users/hoaproject/following{/other_user}","gists_url":"https://api.github.com/users/hoaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/hoaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoaproject/subscriptions","organizations_url":"https://api.github.com/users/hoaproject/orgs","repos_url":"https://api.github.com/users/hoaproject/repos","events_url":"https://api.github.com/users/hoaproject/events{/privacy}","received_events_url":"https://api.github.com/users/hoaproject/received_events","type":"Organization","site_admin":false},"repo":{"id":11146594,"name":"Ruler","full_name":"hoaproject/Ruler","owner":{"login":"hoaproject","id":1519718,"avatar_url":"https://avatars.githubusercontent.com/u/1519718?v=3","gravatar_id":"","url":"https://api.github.com/users/hoaproject","html_url":"https://github.com/hoaproject","followers_url":"https://api.github.com/users/hoaproject/followers","following_url":"https://api.github.com/users/hoaproject/following{/other_user}","gists_url":"https://api.github.com/users/hoaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/hoaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoaproject/subscriptions","organizations_url":"https://api.github.com/users/hoaproject/orgs","repos_url":"https://api.github.com/users/hoaproject/repos","events_url":"https://api.github.com/users/hoaproject/events{/privacy}","received_events_url":"https://api.github.com/users/hoaproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hoaproject/Ruler","description":"The Hoa\\Ruler library.","fork":false,"url":"https://api.github.com/repos/hoaproject/Ruler","forks_url":"https://api.github.com/repos/hoaproject/Ruler/forks","keys_url":"https://api.github.com/repos/hoaproject/Ruler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hoaproject/Ruler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hoaproject/Ruler/teams","hooks_url":"https://api.github.com/repos/hoaproject/Ruler/hooks","issue_events_url":"https://api.github.com/repos/hoaproject/Ruler/issues/events{/number}","events_url":"https://api.github.com/repos/hoaproject/Ruler/events","assignees_url":"https://api.github.com/repos/hoaproject/Ruler/assignees{/user}","branches_url":"https://api.github.com/repos/hoaproject/Ruler/branches{/branch}","tags_url":"https://api.github.com/repos/hoaproject/Ruler/tags","blobs_url":"https://api.github.com/repos/hoaproject/Ruler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hoaproject/Ruler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hoaproject/Ruler/git/refs{/sha}","trees_url":"https://api.github.com/repos/hoaproject/Ruler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hoaproject/Ruler/statuses/{sha}","languages_url":"https://api.github.com/repos/hoaproject/Ruler/languages","stargazers_url":"https://api.github.com/repos/hoaproject/Ruler/stargazers","contributors_url":"https://api.github.com/repos/hoaproject/Ruler/contributors","subscribers_url":"https://api.github.com/repos/hoaproject/Ruler/subscribers","subscription_url":"https://api.github.com/repos/hoaproject/Ruler/subscription","commits_url":"https://api.github.com/repos/hoaproject/Ruler/commits{/sha}","git_commits_url":"https://api.github.com/repos/hoaproject/Ruler/git/commits{/sha}","comments_url":"https://api.github.com/repos/hoaproject/Ruler/comments{/number}","issue_comment_url":"https://api.github.com/repos/hoaproject/Ruler/issues/comments{/number}","contents_url":"https://api.github.com/repos/hoaproject/Ruler/contents/{+path}","compare_url":"https://api.github.com/repos/hoaproject/Ruler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hoaproject/Ruler/merges","archive_url":"https://api.github.com/repos/hoaproject/Ruler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hoaproject/Ruler/downloads","issues_url":"https://api.github.com/repos/hoaproject/Ruler/issues{/number}","pulls_url":"https://api.github.com/repos/hoaproject/Ruler/pulls{/number}","milestones_url":"https://api.github.com/repos/hoaproject/Ruler/milestones{/number}","notifications_url":"https://api.github.com/repos/hoaproject/Ruler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hoaproject/Ruler/labels{/name}","releases_url":"https://api.github.com/repos/hoaproject/Ruler/releases{/id}","deployments_url":"https://api.github.com/repos/hoaproject/Ruler/deployments","created_at":"2013-07-03T09:21:14Z","updated_at":"2016-09-27T14:06:28Z","pushed_at":"2016-09-24T09:38:29Z","git_url":"git://github.com/hoaproject/Ruler.git","ssh_url":"git@github.com:hoaproject/Ruler.git","clone_url":"https://github.com/hoaproject/Ruler.git","svn_url":"https://github.com/hoaproject/Ruler","homepage":"https://hoa-project.net","size":370,"stargazers_count":315,"watchers_count":315,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":14,"forks":34,"open_issues":14,"watchers":315,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hoaproject/Ruler/pulls/96"},"html":{"href":"https://github.com/hoaproject/Ruler/pull/96"},"issue":{"href":"https://api.github.com/repos/hoaproject/Ruler/issues/96"},"comments":{"href":"https://api.github.com/repos/hoaproject/Ruler/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/hoaproject/Ruler/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/hoaproject/Ruler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hoaproject/Ruler/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/hoaproject/Ruler/statuses/e19cf8450a61be33640acc07f68b4110aa32b036"}}}}
{"actor":{"display_login":"dantleech"}}