Using Binarybuilder binary

A few weeks ago, @miguelraz , kindly unleashed binary builder magic to create primecount.jll, which reveals the number of primes below a given number very quickly.

It’s been useful, but I’m still stumped by something…this works great …

using primecount_jll
@time run($(primecount()) 4999933);

But I want to do something like …

using primecount_jll
x = 4999933
@time run($(primecount()) x);

I thought whatever the trick needed would become clear as I used it, but it has not.

1 Like
julia> x=4999933
4999933

julia> run(`$(primecount()) $x`);
348508

But I found an issue. The following doesnt work:

julia> x=1e14
1.0e14

julia> run(`$(primecount()) $x`);

Because the implicit formating into 1.0e14 from 1e14 makes the primecount executable to fail.
But this would work:

julia> x="1e14"
"1e14"

julia> run(`$(primecount()) $x`);
3204941750802
1 Like

Thank you!

Do note that it is much more efficient to just use @ccall, and not spawn an external process with run every time you call the function:

1 Like