{"action":"created","issue":{"url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/463","repository_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache","labels_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/463/comments","events_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/463/events","html_url":"https://github.com/PHPSocialNetwork/phpfastcache/issues/463","id":230215975,"number":463,"title":"performance regression with v6","user":{"login":"mbiebl","id":3609611,"avatar_url":"https://avatars2.githubusercontent.com/u/3609611?v=3","gravatar_id":"","url":"https://api.github.com/users/mbiebl","html_url":"https://github.com/mbiebl","followers_url":"https://api.github.com/users/mbiebl/followers","following_url":"https://api.github.com/users/mbiebl/following{/other_user}","gists_url":"https://api.github.com/users/mbiebl/gists{/gist_id}","starred_url":"https://api.github.com/users/mbiebl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbiebl/subscriptions","organizations_url":"https://api.github.com/users/mbiebl/orgs","repos_url":"https://api.github.com/users/mbiebl/repos","events_url":"https://api.github.com/users/mbiebl/events{/privacy}","received_events_url":"https://api.github.com/users/mbiebl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-21T12:00:04Z","updated_at":"2017-05-21T12:26:56Z","closed_at":null,"body":"### Configuration:\r\n\r\nPhpFastCache version: 6.0.1 / 5.0.16\r\nPHP version: 7.0\r\nOperating system: Linux / Windows\r\n\r\n#### Issue description:\r\n\r\nI've updated a project to phpfastcache v6 and noticed a perfomance regression.\r\nThe project is running on windows using the wincache driver with php 7.0. The perfomance regression compared to 5.0.16 is between 15%-25%.\r\n\r\nI've created a test case, which I've ran under Linux as well using the files backend. The numbers are comparable.\r\nv5.0.16:\r\nfirst run with empty cache: 14.666780948639\r\nsecond run with full cache: 0.75569796562195\r\n\r\nv6.0.1:\r\nfirst run with empty cache: 17.629030942917\r\nsecond run with full cache: 1.1219041347504\r\n\r\nThe code I used writes 100.000 entries and then reads them again from the cache:\r\n```\r\n<?php\r\n\r\nrequire_once('vendor/autoload.php');\r\n\r\nuse \\phpFastCache\\CacheManager;\r\n\r\n$cache = CacheManager::getInstance('files');\r\n$cycles = 100000;\r\n\r\nfunction compute_str($arg) {\r\n    $str = __FUNCTION__ . '-' . $arg . '-' . 'michael@test.example.com';\r\n    $key = str_replace(array('{', '}', '(', ')', '/', '\\\\', '@', ':'), '_', $str);\r\n    return $key;\r\n}\r\n\r\nfunction compute_md5($arg) {\r\n    $str = __FUNCTION__ . '-' . $arg . '-' . 'michael@test.example.com';\r\n    $key = md5($str);\r\n    return $key;\r\n}\r\n\r\nfunction compute_sha1($arg) {\r\n    $str = __FUNCTION__ . '-' . $arg . '-' . 'michael@test.example.com';\r\n    $key = sha1($str);\r\n    return $key;\r\n}\r\n\r\n\r\nfunction compute($arg) {\r\n    return compute_sha1($arg);\r\n}\r\n\r\n$before = microtime(true);\r\nfor ($i=0; $i<$cycles; $i++) {\r\n    $key = compute($i);\r\n    $cachedNum = $cache->getItem($key);\r\n    if (is_null($cachedNum->get())) {\r\n        $cachedNum->set($i*$i);\r\n        $cache->save($cachedNum);\r\n    } else {\r\n        $num = $cachedNum->get();\r\n        if ($num != $i*$i) {\r\n            print (\"Something went wrong: \" . $i . \" -> \" . $num);\r\n        }\r\n    }\r\n}\r\n$after = microtime(true);\r\n$duration = $after - $before;\r\nprint ('first run with empty cache: ' . $duration . \"\\n\");\r\n\r\n$before = microtime(true);\r\nfor ($i=0; $i<$cycles; $i++) {\r\n    $key = compute($i);\r\n    $cachedNum = $cache->getItem($key);\r\n    if (is_null($cachedNum->get())) {\r\n        $cachedNum->set($i*$i);\r\n        $cache->save($cachedNum);\r\n    } else {\r\n        $num = $cachedNum->get();\r\n        if ($num != $i*$i) {\r\n            print (\"Something went wrong: \" . $i . \" -> \" . $num);\r\n        }\r\n    }\r\n}\r\n$after = microtime(true );\r\n$duration = $after - $before;\r\nprint ('second run with full cache: ' . $duration . \"\\n\");\r\n\r\n$cache->clear();\r\n```"},"comment":{"url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/comments/302933682","html_url":"https://github.com/PHPSocialNetwork/phpfastcache/issues/463#issuecomment-302933682","issue_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/463","id":302933682,"user":{"login":"Geolim4","id":1332071,"avatar_url":"https://avatars3.githubusercontent.com/u/1332071?v=3","gravatar_id":"","url":"https://api.github.com/users/Geolim4","html_url":"https://github.com/Geolim4","followers_url":"https://api.github.com/users/Geolim4/followers","following_url":"https://api.github.com/users/Geolim4/following{/other_user}","gists_url":"https://api.github.com/users/Geolim4/gists{/gist_id}","starred_url":"https://api.github.com/users/Geolim4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Geolim4/subscriptions","organizations_url":"https://api.github.com/users/Geolim4/orgs","repos_url":"https://api.github.com/users/Geolim4/repos","events_url":"https://api.github.com/users/Geolim4/events{/privacy}","received_events_url":"https://api.github.com/users/Geolim4/received_events","type":"User","site_admin":false},"created_at":"2017-05-21T12:26:56Z","updated_at":"2017-05-21T12:26:56Z","body":"Hell thanks for that report,\r\n\r\nI'll check it carefully.\r\n\r\nCheers,\r\nGeorges."}}
{"actor":{"display_login":"Geolim4"}}