]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #22593 - brson:spatch, r=steveklabnik
authorManish Goregaokar <manishsmail@gmail.com>
Mon, 23 Feb 2015 09:14:23 +0000 (14:44 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Mon, 23 Feb 2015 17:58:46 +0000 (23:28 +0530)
 r? @steveklabnik

1  2 
src/doc/trpl/static-and-dynamic-dispatch.md

index 98dac9bf84bb47c519eb8f65cdd780452be8510f,84d05c63e8f524841680724d9c19887c12601cfe..1baf41329f561356238a63a37251744dd13046b2
@@@ -79,12 -79,13 +79,13 @@@ fn main() 
  }
  ```
  
- This has some upsides: static dispatching of any method calls, allowing for
- inlining and hence usually higher performance. It also has some downsides:
- causing code bloat due to many copies of the same function existing in the
- binary, one for each type.
+ This has a great upside: static dispatch allows function calls to be
+ inlined because the callee is known at compile time, and inlining is
+ the key to good optimization. Static dispatch is fast, but it comes at
+ a tradeoff: 'code bloat', due to many copies of the same function
+ existing in the binary, one for each type.
  
 -Furthermore, compilers aren’t perfect and may “optimise” code to become slower.
 +Furthermore, compilers aren’t perfect and may “optimize” code to become slower.
  For example, functions inlined too eagerly will bloat the instruction cache
  (cache rules everything around us). This is part of the reason that `#[inline]`
  and `#[inline(always)]` should be used carefully, and one reason why using a