mozilla/rust — pull request #14216 by kballard (2014-05-15 00:59:56+00:00)
Title: Optimize and fix time::precise_time_ns() on macos

Use sync::one::Once to fetch the mach_timebase_info only once when
running precise_time_ns(). This helps because mach_timebase_info() is
surprisingly inefficient. Also fix the order of operations when applying
the timebase to the mach absolute time value.

This improves the time on my machine from

```
test tests::bench_precise_time_ns ... bench: 157 ns/iter (+/- 4)
```

to

```
test tests::bench_precise_time_ns ... bench: 38 ns/iter (+/- 3)
```

and it will get even faster once #14174 lands.