{"action":"opened","issue":{"url":"https://api.github.com/repos/kadirahq/fastcall/issues/2","labels_url":"https://api.github.com/repos/kadirahq/fastcall/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/kadirahq/fastcall/issues/2/comments","events_url":"https://api.github.com/repos/kadirahq/fastcall/issues/2/events","html_url":"https://github.com/kadirahq/fastcall/issues/2","id":105297451,"number":2,"title":"Avoid allocating unnecessary slices","user":{"login":"mnmtanish","id":136691,"avatar_url":"https://avatars.githubusercontent.com/u/136691?v=3","gravatar_id":"","url":"https://api.github.com/users/mnmtanish","html_url":"https://github.com/mnmtanish","followers_url":"https://api.github.com/users/mnmtanish/followers","following_url":"https://api.github.com/users/mnmtanish/following{/other_user}","gists_url":"https://api.github.com/users/mnmtanish/gists{/gist_id}","starred_url":"https://api.github.com/users/mnmtanish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnmtanish/subscriptions","organizations_url":"https://api.github.com/users/mnmtanish/orgs","repos_url":"https://api.github.com/users/mnmtanish/repos","events_url":"https://api.github.com/users/mnmtanish/events{/privacy}","received_events_url":"https://api.github.com/users/mnmtanish/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kadirahq/fastcall/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-08T04:18:42Z","updated_at":"2015-09-08T04:18:42Z","closed_at":null,"body":"In `Conn.Read` function it always creates a new slice to read data. Reducing allocations can save significant amount of cpu time (alloc cpu time + gc cpu time). Instead of doing this, get a slice as an argument and read data into that slice. Also consider that the slice may not have enough space, therefore always return the slice with data which may or may not be the slice provided by the user.\r\n\r\n - https://github.com/kadirahq/fastcall/blob/master/conn.go#L23\r\n\r\nThis changes the method signature to:\r\n\r\n```\r\nfunc (c *Conn) Read(d []byte) (b []byte, err error)\r\n```"}}