SymbolicML / DynamicQuantities.jl

Efficient and type-stable physical quantities in Julia
https://symbolicml.org/DynamicQuantities.jl/dev/
Apache License 2.0
120 stars 15 forks source link

Add `Base.float(::Type{Q})` to fix Meshes.jl #110

Closed MilesCranmer closed 5 months ago

MilesCranmer commented 5 months ago

@mikeingold do you think you could test this out with your workflow, and maybe suggest some extra tests? I think this fixes the root cause of https://github.com/JuliaGeometry/Meshes.jl/issues/688.

Edit: seems like it fixes the issues, so this is good to merge.

github-actions[bot] commented 5 months ago

Benchmark Results

main c479ed3ca20c0b... t[main]/t[c479ed3ca20c0b...]
Quantity/creation/Quantity(x) 3.15 ± 1.3 ns 3.41 ± 0.01 ns 0.926
Quantity/creation/Quantity(x, length=y) 3.11 ± 0.01 ns 3.11 ± 0.001 ns 1
Quantity/with_numbers/*real 3.11 ± 0.01 ns 3.1 ± 0.01 ns 1
Quantity/with_numbers/^int 8.67 ± 2.2 ns 8.05 ± 2.2 ns 1.08
Quantity/with_numbers/^int * real 8.36 ± 2.2 ns 8.67 ± 2.2 ns 0.964
Quantity/with_quantity/+y 4.04 ± 0.001 ns 4.04 ± 0.001 ns 1
Quantity/with_quantity//y 3.42 ± 0.01 ns 3.42 ± 0.01 ns 1
Quantity/with_self/dimension 3.11 ± 0.01 ns 3.1 ± 0.01 ns 1
Quantity/with_self/inv 3.41 ± 0.01 ns 3.11 ± 0.001 ns 1.1
Quantity/with_self/ustrip 3.1 ± 0.01 ns 2.79 ± 0.01 ns 1.11
QuantityArray/broadcasting/multi_array_of_quantities 0.15 ± 0.00099 ms 0.149 ± 0.0013 ms 1.01
QuantityArray/broadcasting/multi_normal_array 0.0499 ± 0.00018 ms 0.0529 ± 0.00017 ms 0.942
QuantityArray/broadcasting/multi_quantity_array 0.155 ± 0.00065 ms 0.155 ± 0.00073 ms 1
QuantityArray/broadcasting/x^2_array_of_quantities 24.5 ± 2.1 μs 24.2 ± 1.9 μs 1.01
QuantityArray/broadcasting/x^2_normal_array 5.36 ± 0.99 μs 5.05 ± 1.1 μs 1.06
QuantityArray/broadcasting/x^2_quantity_array 6.97 ± 0.22 μs 6.98 ± 0.24 μs 0.999
QuantityArray/broadcasting/x^4_array_of_quantities 0.0786 ± 0.00048 ms 0.0785 ± 0.00051 ms 1
QuantityArray/broadcasting/x^4_normal_array 0.0499 ± 0.00018 ms 0.0468 ± 0.00019 ms 1.07
QuantityArray/broadcasting/x^4_quantity_array 0.05 ± 0.00017 ms 0.053 ± 0.00015 ms 0.943
time_to_load 0.129 ± 0.0016 s 0.13 ± 0.00069 s 0.989

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).