OLD | NEW |
1 Name: Compact Language Detection 2 | 1 Name: Compact Language Detection 2 |
2 Short Name: cld_2 | 2 Short Name: cld_2 |
3 URL: https://code.google.com/p/cld2/ | 3 URL: https://code.google.com/p/cld2/ |
4 Version: 0 | 4 Version: 0 |
5 License: Apache 2.0 | 5 License: Apache 2.0 |
6 Security Critical: yes | 6 Security Critical: yes |
7 | 7 |
8 Description: | 8 Description: |
9 The CLD is used to determine the language of text. In Chromium, this is used | 9 The CLD is used to determine the language of text. In Chromium, this is used |
10 to determine if Chrome should offer Translate UX to the user. | 10 to determine if Chrome should offer Translate UX to the user. |
| 11 |
| 12 |
| 13 Dynamic Mode |
| 14 ============ |
| 15 Prior to CLD2's trunk@155, Chromium has always built CLD2 statically. The data |
| 16 needed for CLD2 to perform its language detection has been compiled straight |
| 17 into the binary. This contributes around 1.5 megabytes to the size of Chrome |
| 18 and embeds one or more large rodata sections to the executable. |
| 19 |
| 20 Starting with CLD2's trunk@r155, there is a new option available: dynamic mode. |
| 21 In dynamic mode, CLD2 is built without its data; only the code is compiled, and |
| 22 the data must be supplied at runtime via a file or a pointer to a (presumably |
| 23 mmap'ed) read-only region of memory. |
| 24 |
| 25 Tradeoffs to consider before enabling dynamic mode: |
| 26 |
| 27 Pros: |
| 28 * Reduces the size of the Chromium binary by a bit over a megabyte. |
| 29 * As the data file rarely changes, it can be updated independently. |
| 30 * Depending upon the update process on your platform, this may also reduce |
| 31 the size of Chromium updates. |
| 32 * It is possible to run Chromium without CLD2 data at all (language |
| 33 detection will always fail, but fails gracefully). |
| 34 * Different types of CLD2 data files (larger and more accurate or smaller |
| 35 and less accurate) can be dynamically downloaded or chosen depending |
| 36 on runtime choices. |
| 37 |
| 38 Cons: |
| 39 * Data files must be generated and checked into source control by hand. |
| 40 * At runtime a data file must be opened and its headers parsed before CLD2 |
| 41 can be used in any given process (this time should be negligible in most |
| 42 circumstances). This will prevent language detection from working until |
| 43 a data file has been loaded. |
| 44 |
| 45 To enable dynamic mode, set 'cld_dynamic' to '1' in ../../build/common.gypi. |
| 46 |
| 47 For more information on the changes required to use dynamic mode, see: |
| 48 https://codereview.chromium.org/187393005 |
| 49 |
OLD | NEW |