File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -30,19 +30,19 @@ when the compiler cannot infer dimensions in a function:
30
30
``` julia
31
31
julia> using BenchmarkTools, DynamicQuantities; import Unitful
32
32
33
- julia> dyn_uni = 0.2 u " m^0.5 * kg * mol^3 "
34
- 0.2 m¹ᐟ² kg mol³
33
+ julia> dyn_uni = 0.2 u " m/s "
34
+ 0.2 m s⁻¹
35
35
36
36
julia> unitful = convert (Unitful. Quantity, dyn_uni)
37
- 0.2 kg m¹ᐟ² mol³
37
+ 0.2 m s⁻¹
38
38
39
39
julia> f (x, i) = x ^ i * 0.3 ;
40
40
41
41
julia> @btime f ($ dyn_uni, 1 );
42
- 2.750 ns (0 allocations: 0 bytes)
42
+ 2.708 ns (0 allocations: 0 bytes)
43
43
44
44
julia> @btime f ($ unitful, 1 );
45
- 2.718 μs (30 allocations: 1.34 KiB)
45
+ 2.597 μs (30 allocations: 1.33 KiB)
46
46
```
47
47
48
48
** Note the μ and n: this is a 1000x speedup!**
@@ -56,7 +56,7 @@ then you can get better speeds with Unitful:
56
56
julia> g (x) = x ^ 2 * 0.3 ;
57
57
58
58
julia> @btime g ($ dyn_uni);
59
- 1.875 ns (0 allocations: 0 bytes)
59
+ 1.791 ns (0 allocations: 0 bytes)
60
60
61
61
julia> @btime g ($ unitful);
62
62
1.500 ns (0 allocations: 0 bytes)
You can’t perform that action at this time.
0 commit comments