Skip to content

Fix upreferred issue by loading at runtime #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2023
Merged

Conversation

MilesCranmer
Copy link
Member

@MilesCranmer MilesCranmer commented Jun 8, 2023

This fixes #12.

@j-fu what do you think? This seems to fix things for me:

julia> using Unitful

julia> using DynamicQuantities

julia> Unitful.preferunits(u"km")

julia> x_km = 1.5u"km"
1.5 km

julia> x = 1.5u"m"
1.5 m

julia> x_km_dyn = convert(DynamicQuantities.Quantity, x_km)
1500.0 𝐋 ¹

julia> x_dyn = convert(DynamicQuantities.Quantity, x)
1.5 𝐋 ¹

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

Benchmark Results

main 2e82902... t[main]/t[2e82902...]
creation/Quantity(x) 4 ± 0.1 ns 5.3 ± 0.1 ns 0.755
creation/Quantity(x, length=y) 3.3 ± 0.1 ns 3.3 ± 0.1 ns 1
time_to_load 0.139 ± 0.0015 s 0.139 ± 0.0014 s 1
with_numbers/*real 3.3 ± 0.1 ns 3.3 ± 0.1 ns 1
with_numbers/^int 28.3 ± 2 ns 28.3 ± 1.9 ns 1
with_numbers/^int * real 28.5 ± 2.5 ns 28.5 ± 2.4 ns 1
with_quantity//y 17.8 ± 0.4 ns 17.8 ± 0.4 ns 1
with_quantity/^y 1.1 ± 0.2 μs 1.11 ± 0.2 μs 0.995
with_self/dimension 1.6 ± 0.1 ns 1.6 ± 0.1 ns 1
with_self/inv 18.5 ± 0 ns 18.5 ± 0 ns 1
with_self/ustrip 1.7 ± 0.1 ns 1.6 ± 0.1 ns 1.06

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).

@MilesCranmer MilesCranmer merged commit e345d27 into main Jun 8, 2023
@MilesCranmer MilesCranmer deleted the fix-upreferred branch June 8, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Beware of preferunits
1 participant