Best way to access values in variables

This page summarizes the projects mentioned and recommended in the original post on /r/Julia

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • julia

    The Julia Programming Language

  • bash-3.2$ cat gcd.jl function greatest_common_divisor(x, y) while y != 0 temp = y y = rem(x, y) x = temp end x end bash-3.2$ cat global-int.jl const X = 30 const Y = 24 include("gcd.jl") using BenchmarkTools result = @benchmark greatest_common_divisor(X, Y) @show median(result) @show minimum(result) bash-3.2$ cat global-struct.jl struct Constants x::Int y::Int end const CONSTANTS = Constants(30, 24) include("gcd.jl") using BenchmarkTools result = @benchmark greatest_common_divisor(CONSTANTS.x, CONSTANTS.y) @show median(result) @show minimum(result) bash-3.2$ cat local-int.jl include("gcd.jl") using BenchmarkTools function run() x = 30 y = 24 greatest_common_divisor(x, y) end result = @benchmark run() @show median(result) @show minimum(result) bash-3.2$ cat local-struct.jl struct Constants x::Int y::Int end include("gcd.jl") using BenchmarkTools function run() constants = Constants(30, 24) greatest_common_divisor(constants.x, constants.y) end result = @benchmark run() @show median(result) @show minimum(result) bash-3.2$ julia global-int.jl median(result) = TrialEstimate(3.709 ns) minimum(result) = TrialEstimate(3.625 ns) bash-3.2$ julia global-struct.jl median(result) = TrialEstimate(3.709 ns) minimum(result) = TrialEstimate(3.625 ns) bash-3.2$ julia local-int.jl median(result) = TrialEstimate(3.709 ns) minimum(result) = TrialEstimate(3.625 ns) bash-3.2$ julia local-struct.jl median(result) = TrialEstimate(3.709 ns) minimum(result) = TrialEstimate(3.625 ns) bash-3.2$ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.8.2 (2022-09-29) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | julia> versioninfo() Julia Version 1.8.2 Commit 36034abf260 (2022-09-29 15:21 UTC) Platform Info: OS: macOS (arm64-apple-darwin21.3.0) CPU: 8 × Apple M1 Pro WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1) Threads: 1 on 6 virtual cores julia>

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts