Skip to content

Commit 30ac1e8

Browse files
authored
Simplify example
1 parent 5c4d250 commit 30ac1e8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ when the compiler cannot infer dimensions in a function:
3030
```julia
3131
julia> using BenchmarkTools, DynamicQuantities; import Unitful
3232

33-
julia> dyn_uni = 0.2u"m^0.5 * kg * mol^3"
34-
0.2 m¹ᐟ² kg mol³
33+
julia> dyn_uni = 0.2u"m/s"
34+
0.2 m s⁻¹
3535

3636
julia> unitful = convert(Unitful.Quantity, dyn_uni)
37-
0.2 kg m¹ᐟ² mol³
37+
0.2 m s⁻¹
3838

3939
julia> f(x, i) = x ^ i * 0.3;
4040

4141
julia> @btime f($dyn_uni, 1);
42-
2.750 ns (0 allocations: 0 bytes)
42+
2.708 ns (0 allocations: 0 bytes)
4343

4444
julia> @btime f($unitful, 1);
45-
2.718 μs (30 allocations: 1.34 KiB)
45+
2.597 μs (30 allocations: 1.33 KiB)
4646
```
4747

4848
**Note the μ and n: this is a 1000x speedup!**
@@ -56,7 +56,7 @@ then you can get better speeds with Unitful:
5656
julia> g(x) = x ^ 2 * 0.3;
5757

5858
julia> @btime g($dyn_uni);
59-
1.875 ns (0 allocations: 0 bytes)
59+
1.791 ns (0 allocations: 0 bytes)
6060

6161
julia> @btime g($unitful);
6262
1.500 ns (0 allocations: 0 bytes)

0 commit comments

Comments
 (0)