{"action":"created","issue":{"url":"https://api.github.com/repos/p4lang/p4c/issues/923","repository_url":"https://api.github.com/repos/p4lang/p4c","labels_url":"https://api.github.com/repos/p4lang/p4c/issues/923/labels{/name}","comments_url":"https://api.github.com/repos/p4lang/p4c/issues/923/comments","events_url":"https://api.github.com/repos/p4lang/p4c/issues/923/events","html_url":"https://github.com/p4lang/p4c/pull/923","id":259067446,"number":923,"title":"Add unified compilation support for cmake","user":{"login":"sethfowler","id":492593,"avatar_url":"https://avatars0.githubusercontent.com/u/492593?v=4","gravatar_id":"","url":"https://api.github.com/users/sethfowler","html_url":"https://github.com/sethfowler","followers_url":"https://api.github.com/users/sethfowler/followers","following_url":"https://api.github.com/users/sethfowler/following{/other_user}","gists_url":"https://api.github.com/users/sethfowler/gists{/gist_id}","starred_url":"https://api.github.com/users/sethfowler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethfowler/subscriptions","organizations_url":"https://api.github.com/users/sethfowler/orgs","repos_url":"https://api.github.com/users/sethfowler/repos","events_url":"https://api.github.com/users/sethfowler/events{/privacy}","received_events_url":"https://api.github.com/users/sethfowler/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"sethfowler","id":492593,"avatar_url":"https://avatars0.githubusercontent.com/u/492593?v=4","gravatar_id":"","url":"https://api.github.com/users/sethfowler","html_url":"https://github.com/sethfowler","followers_url":"https://api.github.com/users/sethfowler/followers","following_url":"https://api.github.com/users/sethfowler/following{/other_user}","gists_url":"https://api.github.com/users/sethfowler/gists{/gist_id}","starred_url":"https://api.github.com/users/sethfowler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethfowler/subscriptions","organizations_url":"https://api.github.com/users/sethfowler/orgs","repos_url":"https://api.github.com/users/sethfowler/repos","events_url":"https://api.github.com/users/sethfowler/events{/privacy}","received_events_url":"https://api.github.com/users/sethfowler/received_events","type":"User","site_admin":false},"assignees":[{"login":"sethfowler","id":492593,"avatar_url":"https://avatars0.githubusercontent.com/u/492593?v=4","gravatar_id":"","url":"https://api.github.com/users/sethfowler","html_url":"https://github.com/sethfowler","followers_url":"https://api.github.com/users/sethfowler/followers","following_url":"https://api.github.com/users/sethfowler/following{/other_user}","gists_url":"https://api.github.com/users/sethfowler/gists{/gist_id}","starred_url":"https://api.github.com/users/sethfowler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethfowler/subscriptions","organizations_url":"https://api.github.com/users/sethfowler/orgs","repos_url":"https://api.github.com/users/sethfowler/repos","events_url":"https://api.github.com/users/sethfowler/events{/privacy}","received_events_url":"https://api.github.com/users/sethfowler/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2017-09-20T07:34:59Z","updated_at":"2017-09-22T23:20:58Z","closed_at":"2017-09-20T23:59:31Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/p4lang/p4c/pulls/923","html_url":"https://github.com/p4lang/p4c/pull/923","diff_url":"https://github.com/p4lang/p4c/pull/923.diff","patch_url":"https://github.com/p4lang/p4c/pull/923.patch"},"body":"Finally, the joys of unified compilation have returned to us.\r\n\r\nCheck out the comments in `UnifiedBuild.cmake` and in particular on the `build_unified()` function. It's pretty straightforward to use. `build_unified(FOO_SRCS)` generates a set of unified sources for the files in `FOO_SRCS` and then modifies `FOO_SRCS` to refer to those files instead of the original files.\r\n\r\nTwo options are exposed:\r\n- `UNIFIED_COMPILATION_ENABLED` controls whether unified compilation is enabled at all.\r\n- `UNIFIED_SOURCE_CHUNK_SIZE` controls the chunk size - i.e., the number of source files included in each unified source file. You can set it to `ALL` to unify as thoroughly as possible.\r\n\r\nBoth the standard `GENERATED` property and the custom `NONUNIFIED` property will exclude a source file from being unified, even if it gets passed to `build_unified()`.\r\n\r\nWhen you call `build_unified()`, you can override the global `UNIFIED_SOURCE_CHUNK_SIZE`. I use this in a number of places to pass `ALL` for parts of the compiler that change very rarely, since in those cases there isn't much need to balance full build speed with incremental compilation speed.\r\n\r\nOne thing that I currently don't do is unify GTests added by backends or extensions. It's just too error-prone as things standard now; we should rework the GTest extension mechanism to use actual libraries. Consider that future work.\r\n\r\nSome numbers:\r\n\r\n```\r\nNONUNIFIED BUILD: -j8, empty ccache\r\n      161.26 real      1049.17 user        48.95 sys \r\nUNIFIED BUILD: -j8, empty ccache\r\n       52.94 real       262.93 user        12.42 sys\r\n```\r\n\r\n1/4 the CPU time. 3x faster in terms of wall clock time. With this patch, a clean full build takes under a minute."},"comment":{"url":"https://api.github.com/repos/p4lang/p4c/issues/comments/331581725","html_url":"https://github.com/p4lang/p4c/pull/923#issuecomment-331581725","issue_url":"https://api.github.com/repos/p4lang/p4c/issues/923","id":331581725,"user":{"login":"mbudiu-vmw","id":19397042,"avatar_url":"https://avatars1.githubusercontent.com/u/19397042?v=4","gravatar_id":"","url":"https://api.github.com/users/mbudiu-vmw","html_url":"https://github.com/mbudiu-vmw","followers_url":"https://api.github.com/users/mbudiu-vmw/followers","following_url":"https://api.github.com/users/mbudiu-vmw/following{/other_user}","gists_url":"https://api.github.com/users/mbudiu-vmw/gists{/gist_id}","starred_url":"https://api.github.com/users/mbudiu-vmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbudiu-vmw/subscriptions","organizations_url":"https://api.github.com/users/mbudiu-vmw/orgs","repos_url":"https://api.github.com/users/mbudiu-vmw/repos","events_url":"https://api.github.com/users/mbudiu-vmw/events{/privacy}","received_events_url":"https://api.github.com/users/mbudiu-vmw/received_events","type":"User","site_admin":false},"created_at":"2017-09-22T23:20:58Z","updated_at":"2017-09-22T23:20:58Z","author_association":"COLLABORATOR","body":"I can't reproduce this problem; if it happens again I will post some more detailed logs.\r\nSorry for the trouble."}}
{"actor":{"display_login":"mbudiu-vmw"}}