Skip to content

Commit bf531b7

Browse files
authored
Update build advice for benchmarking and profiling (#22)
* Profiling: update recommended build instructions * Building Servo: update production; add -stripped and profiling
1 parent c0c5d24 commit bf531b7

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

src/hacking/building-servo.md

+43-7
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,58 @@ There are three main build profiles, which you can build and use independently o
5252
<th>mach option
5353
<td><code>-d</code>
5454
<td><code>-r</code>
55-
<td><code>--profile production</code>
55+
<td><code>--prod</code>
5656
<tr>
5757
<th>optimised?
58-
<td>no<td>yes<td>yes
58+
<td><a href="https://doc.rust-lang.org/cargo/reference/profiles.html#dev">no</a>
59+
<td><a href="https://github.com/servo/servo/blob/457d37d94ee6966cad377c373d333a00c637e1ae/Cargo.toml#L153">yes</a>
60+
<td>yes, <a href="https://github.com/servo/servo/blob/457d37d94ee6966cad377c373d333a00c637e1ae/Cargo.toml#L159-L160">more</a> <a href="https://github.com/servo/servo/blob/457d37d94ee6966cad377c373d333a00c637e1ae/Cargo.toml#L170-L171">than</a> in <strong>release</strong>
5961
<tr>
60-
<th>debug info?
61-
<td>yes<td>no<td>no
62+
<th>maximum RUST_LOG level
63+
<td><code>trace</code>
64+
<td><code>info</code>
65+
<td><code>info</code>
6266
<tr>
6367
<th>debug assertions?
6468
<td>yes<td>yes(!)<td>no
6569
<tr>
66-
<th>maximum RUST_LOG level
67-
<td><code>trace</code><td><code>info</code><td><code>info</code>
70+
<th>debug info?
71+
<td>yes<td>no<td>no
72+
<tr>
73+
<th>symbols?
74+
<td>yes<td>no<td>yes
75+
<tr>
76+
<th>finds resources in<br>current working dir?
77+
<td>yes<td>yes<td>no(!)
78+
</table>
79+
80+
There are also two special variants of production builds for performance-related use cases:
81+
82+
- `production-stripped` builds are ideal for benchmarking Servo over time, with debug symbols stripped for faster initial startup
83+
- `profiling` builds are ideal for [profiling](profiling.md) and troubleshooting performance issues; they behave like a debug or release build, but have the same performance as a production build
84+
85+
<table>
86+
<thead>
87+
<tr>
88+
<th>
89+
<th>production
90+
<th>production-stripped
91+
<th>profiling
92+
<tbody>
93+
<tr>
94+
<th>mach <code>--profile</code>
95+
<td><code>production</code>
96+
<td><code>production-stripped</code>
97+
<td><code>profiling</code>
98+
<tr>
99+
<th>debug info?
100+
<td>no<td>no<td>yes
101+
<tr>
102+
<th>symbols?
103+
<td>yes<td>no<td>yes
68104
<tr>
69105
<th>finds resources in<br>current working dir?
70-
<td>yes<td>yes<td>no
106+
<td>no<td>no<td>yes(!)
71107
</table>
72108

73109
You can change these settings in a servobuild file (see [servobuild.example](https://github.com/servo/servo/blob/b79e2a0b6575364de01b1f89021aba0ec3fcf399/servobuild.example)) or in the root [Cargo.toml](https://github.com/servo/servo/blob/b79e2a0b6575364de01b1f89021aba0ec3fcf399/Cargo.toml).

src/hacking/profiling.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22

33
# Profiling
44

5-
First, ensure that you are building Servo in release (optimized) mode with optimal debugging symbols:
6-
In Cargo.toml:
5+
When profiling Servo or troubleshooting performance issues, make sure your build is optimised while still allowing for accurate profiling data.
76

8-
```
9-
[profile.release]
10-
debug = true
11-
lto = false
7+
```sh
8+
$ ./mach build --profile profiling --with-frame-pointer
129
```
1310

14-
```
15-
./mach build --release --with-frame-pointers
16-
```
11+
- **--profile profiling** builds Servo with [our profiling configuration](building-servo.md#build-profiles)
12+
- **--with-frame-pointer** builds Servo with stack frame pointers on all platforms
1713

1814
Several ways to get profiling information about Servo's runs:
1915
* [Interval Profiling](#interval-profiling)

0 commit comments

Comments
 (0)