{"action":"created","issue":{"url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/34","repository_url":"https://api.github.com/repos/zombiezen/go-capnproto2","labels_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/34/comments","events_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/34/events","html_url":"https://github.com/zombiezen/go-capnproto2/issues/34","id":159534482,"number":34,"title":"Code size of generated packages is excessive.","user":{"login":"zenhack","id":883774,"avatar_url":"https://avatars.githubusercontent.com/u/883774?v=3","gravatar_id":"","url":"https://api.github.com/users/zenhack","html_url":"https://github.com/zenhack","followers_url":"https://api.github.com/users/zenhack/followers","following_url":"https://api.github.com/users/zenhack/following{/other_user}","gists_url":"https://api.github.com/users/zenhack/gists{/gist_id}","starred_url":"https://api.github.com/users/zenhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zenhack/subscriptions","organizations_url":"https://api.github.com/users/zenhack/orgs","repos_url":"https://api.github.com/users/zenhack/repos","events_url":"https://api.github.com/users/zenhack/events{/privacy}","received_events_url":"https://api.github.com/users/zenhack/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zombiezen/go-capnproto2/labels/performance","name":"performance","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-10T00:01:20Z","updated_at":"2016-06-10T00:14:50Z","closed_at":null,"body":"For the sandstorm schema, on linux amd64 `grain.a` is 19MiB (!). Many of the others are rather large as well. As a point of comparision, the largest package in the go standard library is `net/http`, the `.a` for which is ~3.7MiB.\r\n\r\nOne thing I have noticed is that the struct wrappers and accessor functions add up. I did some mesurments a while back and never got around to filing the bug. IIRC, each of these cost us one or two hundred KiB:\r\n\r\nhttps://github.com/zenhack/go.sandstorm/blob/master/capnp/grain/grain.capnp.go#L15\r\n\r\nThose got noticably smaller when I took out the if statement (it's pretty easy to imagine a compiler inlining it into a noop in that case, though I don't think it actually does). Not enough to solve the problem on it's own though.\r\n\r\nI started to play with killing the struct wrappers and making types direct aliases of the field they're now wrapping, which IIRC would allow more functions to be effectively noops, but ran into issues with copying non-exported fields, which I didn't spend much time fussing with.\r\n\r\nI'd like to visualize the sizes of various functions to get a sense of where the space is being taken up; probably more efficient than the futzing with schema and modifications to templates I was doing. Would need to research tooling for that; haven't dug into it much yet."},"comment":{"url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/comments/225063092","html_url":"https://github.com/zombiezen/go-capnproto2/issues/34#issuecomment-225063092","issue_url":"https://api.github.com/repos/zombiezen/go-capnproto2/issues/34","id":225063092,"user":{"login":"zombiezen","id":181535,"avatar_url":"https://avatars.githubusercontent.com/u/181535?v=3","gravatar_id":"","url":"https://api.github.com/users/zombiezen","html_url":"https://github.com/zombiezen","followers_url":"https://api.github.com/users/zombiezen/followers","following_url":"https://api.github.com/users/zombiezen/following{/other_user}","gists_url":"https://api.github.com/users/zombiezen/gists{/gist_id}","starred_url":"https://api.github.com/users/zombiezen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zombiezen/subscriptions","organizations_url":"https://api.github.com/users/zombiezen/orgs","repos_url":"https://api.github.com/users/zombiezen/repos","events_url":"https://api.github.com/users/zombiezen/events{/privacy}","received_events_url":"https://api.github.com/users/zombiezen/received_events","type":"User","site_admin":false},"created_at":"2016-06-10T00:14:50Z","updated_at":"2016-06-10T00:14:50Z","body":"Argh, I was wondering about this and hadn't gotten around to actually measuring it.  I can't imagine v1 is much better, but we do error checking, which probably messes with inlining.  Do you know if Go 1.6 versus Go 1.7 makes a difference?"}}
{"actor":{"display_login":"zombiezen"}}