If I may ask: What is the purpose of wrapping the inputs in [ ]
? Why not just Term(sqrt, 2)
, which seems to give the same results, but is dramatically faster?
jl> @btime Term(sqrt, big(2))
54.888 ns (3 allocations: 56 bytes)
sqrt(2)
jl> @btime Term(sqrt, [big(2)])
742.268 ns (8 allocations: 344 bytes)
sqrt(2)
jl> @btime Term(sqrt, 2)
6.200 ns (1 allocation: 16 bytes)
sqrt(2)
jl> @btime Term(sqrt, [2])
781.111 ns (6 allocations: 304 bytes)
sqrt(2)
When you use eval(toexpr())
the speed difference is small, but is there any difference in meaning?