{"action":"created","issue":{"url":"https://api.github.com/repos/dingo/api/issues/610","labels_url":"https://api.github.com/repos/dingo/api/issues/610/labels{/name}","comments_url":"https://api.github.com/repos/dingo/api/issues/610/comments","events_url":"https://api.github.com/repos/dingo/api/issues/610/events","html_url":"https://github.com/dingo/api/issues/610","id":103458960,"number":610,"title":"$this->response->collection() with Transformer is very slow","user":{"login":"refear99","id":7454701,"avatar_url":"https://avatars.githubusercontent.com/u/7454701?v=3","gravatar_id":"","url":"https://api.github.com/users/refear99","html_url":"https://github.com/refear99","followers_url":"https://api.github.com/users/refear99/followers","following_url":"https://api.github.com/users/refear99/following{/other_user}","gists_url":"https://api.github.com/users/refear99/gists{/gist_id}","starred_url":"https://api.github.com/users/refear99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/refear99/subscriptions","organizations_url":"https://api.github.com/users/refear99/orgs","repos_url":"https://api.github.com/users/refear99/repos","events_url":"https://api.github.com/users/refear99/events{/privacy}","received_events_url":"https://api.github.com/users/refear99/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-27T08:52:16Z","updated_at":"2015-08-31T11:03:37Z","closed_at":null,"body":"this is my code\r\n```php\r\n    $list = \\Cache::remember('bannerList', 120, function () {\r\n            $bannerList = Event::get();\r\n\r\n            return $bannerList;\r\n    });\r\n\r\n    return \\Api::response()->collection($list, new Transformers\\BannerTransformer);\r\n```\r\n\r\nthis is BannerTransformer\r\n\r\n```php\r\nnamespace App\\Http\\Controllers\\Api\\Slime\\Transformers;\r\n\r\nclass BannerTransformer extends \\League\\Fractal\\TransformerAbstract\r\n{\r\n    /**\r\n     * @param \\App\\Models\\Event $item\r\n     *\r\n     * @return array\r\n     */\r\n    public function transform($item)\r\n    {\r\n        return [\r\n            'url'   => $item->url\r\n        ];\r\n    }\r\n}\r\n```\r\n\r\nwith cache, this take 300-500 ms to response, but use `\\Api::response()->array()` or `\\Api::response()->item()` or `response()->json()`, it's response in 30ms\r\n\r\nbut, when i change to this\r\n```php\r\n    $list = \\Cache::remember('bannerList', 120, function () {\r\n            $bannerList = Event::get();\r\n\r\n            return collect($bannerList); //collect\r\n    });\r\n\r\n    return \\Api::response()->collection($list, new Transformers\\BannerTransformer);\r\n```\r\nit's OK\r\nwhat am i doing wrong ?"},"comment":{"url":"https://api.github.com/repos/dingo/api/issues/comments/136335833","html_url":"https://github.com/dingo/api/issues/610#issuecomment-136335833","issue_url":"https://api.github.com/repos/dingo/api/issues/610","id":136335833,"user":{"login":"jasonlewis","id":829059,"avatar_url":"https://avatars.githubusercontent.com/u/829059?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonlewis","html_url":"https://github.com/jasonlewis","followers_url":"https://api.github.com/users/jasonlewis/followers","following_url":"https://api.github.com/users/jasonlewis/following{/other_user}","gists_url":"https://api.github.com/users/jasonlewis/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonlewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonlewis/subscriptions","organizations_url":"https://api.github.com/users/jasonlewis/orgs","repos_url":"https://api.github.com/users/jasonlewis/repos","events_url":"https://api.github.com/users/jasonlewis/events{/privacy}","received_events_url":"https://api.github.com/users/jasonlewis/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T11:03:37Z","updated_at":"2015-08-31T11:03:37Z","body":"I'll do some benchmarking and see what I can come up with in the coming days.\r\n\r\n@catalinux have you tried `optimize` as well?"}}