Skip to content

Commit 0dfbed9

Browse files
authored
Update timings with Ratios.SimpleRational
1 parent 2722057 commit 0dfbed9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ julia> unitful = convert(Unitful.Quantity, dyn_uni)
2626
julia> f(x) = x ^ rand(1:10) * 0.3;
2727

2828
julia> @btime f($dyn_uni);
29-
80.449 ns (0 allocations: 0 bytes)
29+
41.330 ns (0 allocations: 0 bytes)
3030

3131
julia> @btime f($unitful);
32-
29.666 μs (42 allocations: 1.91 KiB)
32+
29.542 μs (42 allocations: 1.91 KiB)
3333
```
3434

3535
(Note the μ and n.)
3636
Here, the DynamicUnits quantity object allows the compiler to build a function that is type stable,
3737
while the Unitful quantity object, which stores its dimensions in the type, requires type inference at runtime.
3838

3939
However, if the dimensions in your function *can* be inferred by the compiler,
40-
then you are better off using Unitful:
40+
then you can get better speeds with Unitful:
4141

4242
```julia
4343
julia> g(x) = x ^ 2 * 0.3;
4444

4545
julia> @btime g($dyn_uni);
46-
56.317 ns (0 allocations: 0 bytes)
46+
6.083 ns (0 allocations: 0 bytes)
4747

4848
julia> @btime g($unitful);
4949
1.958 ns (0 allocations: 0 bytes)

0 commit comments

Comments
 (0)