]> git.lizzy.rs Git - rust.git/commit
auto merge of #14216 : kballard/rust/macos_precise_time_ns, r=alexcrichton
authorbors <bors@rust-lang.org>
Fri, 16 May 2014 23:31:24 +0000 (16:31 -0700)
committerbors <bors@rust-lang.org>
Fri, 16 May 2014 23:31:24 +0000 (16:31 -0700)
commit2216eceea51b344560f4791336b3ea2c897eec39
tree231d3f6640253dc2371426efe5ea67ff53b8d226
parentcea4803d4cf56ded65be6a9e043a6219c661c572
parent8ef3e227198f6ff674b1626d0862c4112358c1a1
auto merge of #14216 : kballard/rust/macos_precise_time_ns, r=alexcrichton

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.
src/libtime/lib.rs