Skip to content

Commit ebdfaab

Browse files
committed
w
1 parent bdda4da commit ebdfaab

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

vision/why-compile-time-evaluation.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ prevents the input for that computation to simply be a generic or function param
1515

1616
## Why const generics?
1717

18-
In most cases, const evaluation by itself is good enough, so const generics isn't needed. An exception to this is
19-
if the value should influence the type system.
18+
Const evaluation by itself is good enough unless it should influence the type system.
2019

21-
This is needed when influencing the layout of types, most often by using arrays.
22-
Using arrays instead of dynamic allocations or slices can improve the performance, reduces the dynamic memory footprint
23-
and can remove the runtime checks and implicit invariants.
20+
This is needed when computing the layout of types, most often by using arrays.
21+
Using arrays instead of dynamic allocations or slices can improve performance, reduces the dynamic memory footprint
22+
and can remove runtime checks and implicit invariants.
2423

2524
Another reason is to be generic over configurations or to move certain conditions to compile time. Consider [image handles](https://github.com/EmbarkStudios/rust-gpu/blob/1431c18b9db70feafc64e5096a64e5fefffbed18/crates/spirv-std/src/image.rs#L31) in [`rust-gpu`](https://github.com/EmbarkStudios/rust-gpu) or TODO: example for state machines.
2625

0 commit comments

Comments
 (0)