Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: docs/jumbo.md

Issue 2968963002: Some documentation for the jumbo feature. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Jumbo / Unity builds
2
3 To improve compilation times it is possible to use "unity builds", called Jumbo builds, in Chromium. The idea is to merge many compilation units and compile the m together. Since a large portion of Chromium's code is in shared header files t hat dramatically reduces the total amount of work needed.
brucedawson 2017/07/05 21:50:41 compilation units-> translation units.
Daniel Bratell 2017/07/06 09:48:11 Done.
4
5 ## Build instructions
6
7 If jumbo isn't already enabled, you enable it in `gn` by setting `use_jumbo_buil d = true` then compile as normal.
8
9 ## Implementation
10
11 Jumbo is currently implemented as a combined `gn` template and a python script. Eventually it may become at native `gn` feature. By using the template `jumbo_ta rget`, each target will split into one action to "merge" the files and one actio n to compile the merged files and any files left outside the merge.
brucedawson 2017/07/05 21:50:40 'at native' -> 'a native'
Daniel Bratell 2017/07/06 09:48:12 Done.
12
13 Template file: `//build/config/jumbo.gni`
14 Merge script: `//build/config/merge_for_jumbo.py`
15
16 ### Merge
17 The "merge" is currently done by creating wrapper files that include the source files.
brucedawson 2017/07/05 21:50:41 "include" or "#include" - there's a big difference
Daniel Bratell 2017/07/06 09:48:12 Done. #include for now. We used concatenated file
18
19 ## Jumbo Pros and Cons
20
21 ### Pros
22
23 * Everything compiles faster. When fully enabled everywhere this can **save hour s** for a single full compile on a moderate computer.
brucedawson 2017/07/05 21:50:41 -< for a single full compile on a moderate compute
Daniel Bratell 2017/07/06 08:28:29 I think the answer is "tests". Browser tests and u
Daniel Bratell 2017/07/06 09:48:12 Done.
24 * Linking is faster because there is less debug data to merge.
brucedawson 2017/07/05 21:50:41 -< less debug data to merge. -> less redundant dat
Daniel Bratell 2017/07/06 09:48:12 Done.
25 * Certain code bugs can be statically detected by the compiler when it sees more /all the relevant source code.
26
27 ### Cons
28
29 * By merging many files, symbols in different `cc` files can collide and cause c ompilation errors.
brucedawson 2017/07/05 21:50:41 -< symbols in different `cc` files can collide and
Daniel Bratell 2017/07/06 09:48:12 Done.
30 * The smallest possible compilation unit grows which can add 10-20 seconds to so me single file recompilations (though link times often shrink).
31
32 ### Mixed blessing
33 * Slightly different compiler warnings will be active.
34
35 ## Tuning
36
37 By default at most `200` files are merged at a time. The more files are merged, the less total CPU time is needed, but parallelism is reduced. This can be chang ed by setting `jumbo_file_merge_limit` to something else than `200`.
38
39 ## Naming
40
41 The term jumbo is used to avoid the confusion resulting from talking about unity builds since unity is also the name of a graphical environment, a 3D engine, a webaudio filter and part of the QUIC congestion control code. Jumbo has been use d as name for a unity build system in another browser engine.
42
43 ## Want to make your favourite piece of code jumbo?
44
45 1. Add `import("//build/config/jumbo.gni")` to `BUILD.gn`.
46 2. Change your target, for instance `static_library`, to `jumbo_target`
47 3. Add a local variable `target_type` with the name of the final target/template . For instance `target_type = "static_library"`
48 4. Recompile and test.
49
50 ### Example
51 Change from:
52
53 static_library("foothing") {
54 sources = [
55 "foothing.cc"
56 "fooutil.cc"
57 "fooutil.h"
58 ]
59 }
60 to:
61
62 import("//build/config/jumbo.gni") # ADDED LINE
63 jumbo_target("foothing") { # CHANGED LINE
64 target_type = "static_library" # ADDED LINE
65 sources = [
66 "foothing.cc"
67 "fooutil.cc"
68 "fooutil.h"
69 ]
70 }
71
72
73 If you see some compilation errors about colliding symbols, resolve those by ren aming symbols or removing duplicate code. If it's impractical to change the cod e, add a `jumbo_excluded_sources` variable to your target in `BUILD.gn`:
74 `jumbo_excluded_sources = [ "problematic_file.cc" ]`
75
76 ## More information and pictures.
77 There are more information and pictures in a [Google Document](https://docs.goog le.com/document/d/19jGsZxh7DX8jkAKbL1nYBa5rcByUL2EeidnYsoXfsYQ)
78
79 ## Mailing List
80 Public discussions happen on the generic blink-dev and chromium-dev mailing list s.
81
82 https://groups.google.com/a/chromium.org/group/chromium-dev/topics
83
84 ## Bugs / feature requests
85 Related bugs use the label `jumbo` in the bug database.
86 See [the open bugs](http://code.google.com/p/chromium/issues/list?q=label:jumbo) .
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698