{"action":"created","issue":{"url":"https://api.github.com/repos/labstack/echo/issues/107","labels_url":"https://api.github.com/repos/labstack/echo/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/labstack/echo/issues/107/comments","events_url":"https://api.github.com/repos/labstack/echo/issues/107/events","html_url":"https://github.com/labstack/echo/issues/107","id":90798415,"number":107,"title":"Using if in favor of switch","user":{"login":"syntaqx","id":6037730,"avatar_url":"https://avatars.githubusercontent.com/u/6037730?v=3","gravatar_id":"","url":"https://api.github.com/users/syntaqx","html_url":"https://github.com/syntaqx","followers_url":"https://api.github.com/users/syntaqx/followers","following_url":"https://api.github.com/users/syntaqx/following{/other_user}","gists_url":"https://api.github.com/users/syntaqx/gists{/gist_id}","starred_url":"https://api.github.com/users/syntaqx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syntaqx/subscriptions","organizations_url":"https://api.github.com/users/syntaqx/orgs","repos_url":"https://api.github.com/users/syntaqx/repos","events_url":"https://api.github.com/users/syntaqx/events{/privacy}","received_events_url":"https://api.github.com/users/syntaqx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-24T22:49:25Z","updated_at":"2015-06-24T23:01:31Z","closed_at":null,"body":"Not entirely sure why this is the case, but based on my findings and the experiment listed below, I would consider replacing https://github.com/labstack/echo/blob/master/middleware/logger.go#L28-L35 with an if/else block for a *slight* performance increase.\r\n\r\nIf you agree with this change, please let me know and I will be happy to send a pull request (and also replace other switches found such as in `echo.wrapMiddleware` and `echo.wrapHandler`)\r\n\r\nAn example experiment can be found here: https://gist.github.com/syntaqx/bd98b1b15d45da1b7778"},"comment":{"url":"https://api.github.com/repos/labstack/echo/issues/comments/115040958","html_url":"https://github.com/labstack/echo/issues/107#issuecomment-115040958","issue_url":"https://api.github.com/repos/labstack/echo/issues/107","id":115040958,"user":{"login":"vishr","id":314036,"avatar_url":"https://avatars.githubusercontent.com/u/314036?v=3","gravatar_id":"","url":"https://api.github.com/users/vishr","html_url":"https://github.com/vishr","followers_url":"https://api.github.com/users/vishr/followers","following_url":"https://api.github.com/users/vishr/following{/other_user}","gists_url":"https://api.github.com/users/vishr/gists{/gist_id}","starred_url":"https://api.github.com/users/vishr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishr/subscriptions","organizations_url":"https://api.github.com/users/vishr/orgs","repos_url":"https://api.github.com/users/vishr/repos","events_url":"https://api.github.com/users/vishr/events{/privacy}","received_events_url":"https://api.github.com/users/vishr/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T23:01:31Z","updated_at":"2015-06-24T23:01:31Z","body":"I just got 1 ns diff - not worth it.\r\n```sh\r\nPASS\r\nBenchmarkSwitch\t10000000\t       199 ns/op\r\nBenchmarkIf\t10000000\t       200 ns/op\r\n```\r\n`echo.wrapMiddleware` and `echo.wrapHandler` uses type switch and they are not on critical path - just run once."}}