Move profiling to a separate page in the manual

pull/522/head
Wilfred Hughes 2023-05-21 23:37:15 +07:00
parent b0a3a0ada9
commit d134bc8e9a
3 changed files with 28 additions and 28 deletions

@ -13,6 +13,7 @@
- [Contributing](./contributing.md)
- [Parser Vendoring](./parser_vendoring.md)
- [Adding A Parser](./adding_a_parser.md)
- [Profiling](./profiling.md)
- [Glossary](./glossary.md)
- [Alternative Projects](./alternative_projects.md)
- [Tree Diffing](./tree_diffing.md)

@ -79,34 +79,6 @@ $ DFT_LOG=debug cargo run sample_files/old.jsx sample_files/new.jsx
See the [`env_logger`
documentation](https://docs.rs/env_logger/0.9.0/env_logger/) for full details.
## Profiling
If you have a file that's particularly slow, you can use
[cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) to see
which functions are slow.
```
$ CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --bin difft sample_files/slow_before.rs sample_files/slow_after.rs
```
It's also worth looking at memory usage, as graph traversal bugs can
lead to huge memory consumption.
```
$ /usr/bin/time -v ./target/release/difft sample_files/slow_before.rs sample_files/slow_after.rs
```
If timing measurement are noisy, Linux's `perf` tool will report
instructions executed, which is more stable.
```
$ perf stat ./target/release/difft sample_files/slow_before.rs sample_files/slow_after.rs
$ perf stat ./target/release/difft sample_files/typing_old.ml sample_files/typing_new.ml
```
Many more profiling techniques are discussed in [The Rust Performance
Book](https://nnethercote.github.io/perf-book/).
## Releasing
Use Cargo to create a new release, and tag it in git. Difftastic has a

@ -0,0 +1,27 @@
## Profiling
If you have a file that's particularly slow, you can use
[cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) to see
which functions are slow.
```
$ CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --bin difft sample_files/slow_before.rs sample_files/slow_after.rs
```
It's also worth looking at memory usage, as graph traversal bugs can
lead to huge memory consumption.
```
$ /usr/bin/time -v ./target/release/difft sample_files/slow_before.rs sample_files/slow_after.rs
```
If timing measurement are noisy, Linux's `perf` tool will report
instructions executed, which is more stable.
```
$ perf stat ./target/release/difft sample_files/slow_before.rs sample_files/slow_after.rs
$ perf stat ./target/release/difft sample_files/typing_old.ml sample_files/typing_new.ml
```
Many more profiling techniques are discussed in [The Rust Performance
Book](https://nnethercote.github.io/perf-book/).