Skip to content

Commit 692ac4d

Browse files
committed
add oli note
1 parent f4e7bbe commit 692ac4d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/appendix/glossary.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ LTO | Link-Time Optimizations. A set of optimizations offer
4545
memoize | memoization is the process of storing the results of (pure) computations (such as pure function calls) to avoid having to repeat them in the future. This is typically a trade-off between execution speed and memory usage.
4646
MIR | the Mid-level IR that is created after type-checking for use by borrowck and codegen ([see more](../mir/index.html))
4747
miri | an interpreter for MIR used for constant evaluation ([see more](../miri.html))
48+
monomorphize | Monomorphization is the process of taking generic implementations of types and functions and producing instantiating them with concrete types. For example, in the code we might have `Vec<T>`, but in the final executable, we will have a copy of the `Vec` code for every concrete type used in the program (e.g. a copy for `Vec<usize>`, a copy for `Vec<MyStruct>`, etc).
4849
normalize | a general term for converting to a more canonical form, but in the case of rustc typically refers to [associated type normalization](../traits/associated-types.html#normalize)
4950
newtype | a "newtype" is a wrapper around some other type (e.g., `struct Foo(T)` is a "newtype" for `T`). This is commonly used in Rust to give a stronger type for indices.
5051
NLL | [non-lexical lifetimes](../borrow_check/region_inference.html), an extension to Rust's borrowing system to make it be based on the control-flow graph.

src/mir/optimizations.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
MIR optimizations are optimizations run on the [MIR][mir] to produce better MIR
44
before codegen. This is important for two reasons: first, it make the final
55
generated executable code better, and second, it means that LLVM has less work
6-
to do, so compilation is faster.
6+
to do, so compilation is faster. Note that since MIR is generic (not
7+
[monomorphized][monomorph] yet), these optimizations are particularly
8+
effective; we can optimize the generic version, so all of the monomorphizations
9+
are cheaper!
710

811
[mir]: https://rust-lang.github.io/rustc-guide/mir/index.html
12+
[monomorph]: https://rust-lang.github.io/rustc-guide/appendix/glossary.html?highlight=monomorphize#appendix-c-glossary
913

1014
MIR optimizations run after borrow checking. We run a series of optimization
1115
passes over the MIR to improve it. Some passes are required to run on all code,

0 commit comments

Comments
 (0)