Open julbinb opened 3 years ago
getfield would be more efficient than eval in getting the value of a variable/type here:
getfield
eval
https://github.com/queryverse/Query.jl/blob/a4c0ea1e18227d0495a5bd764e7fae4328a56113/src/table_query_macros.jl#L75
Toy example:
julia> using BenchmarkTools julia> @btime getfield(Main, Symbol("Int")) 0.015 ns (0 allocations: 0 bytes) Int64 julia> @btime eval(Symbol("Int")) 58.841 ns (0 allocations: 0 bytes) Int64
Yep, true :) Do you want to open a PR?
Probably doesn't make too much of a difference because it shouldn't really run in any kind of inner loop, but still would be nice to fix this.
Sure :)
getfield
would be more efficient thaneval
in getting the value of a variable/type here:https://github.com/queryverse/Query.jl/blob/a4c0ea1e18227d0495a5bd764e7fae4328a56113/src/table_query_macros.jl#L75
Toy example: