File tree 1 file changed +5
-4
lines changed 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,11 @@ fn main() {
79
79
}
80
80
```
81
81
82
- This has some upsides: static dispatching of any method calls, allowing for
83
- inlining and hence usually higher performance. It also has some downsides:
84
- causing code bloat due to many copies of the same function existing in the
85
- binary, one for each type.
82
+ This has a great upside: static dispatch allows function calls to be
83
+ inlined because the callee is known at compile time, and inlining is
84
+ the key to good optimization. Static dispatch is fast, but it comes at
85
+ a tradeoff: 'code bloat', due to many copies of the same function
86
+ existing in the binary, one for each type.
86
87
87
88
Furthermore, compilers aren’t perfect and may “optimise” code to become slower.
88
89
For example, functions inlined too eagerly will bloat the instruction cache
You can’t perform that action at this time.
0 commit comments