Weird! With Julia 1.6.1 and Python 3.9.5 on a 2.7 GHz Intel Core i7:
julia> function test(iter=100_000)
for _ in 1:iter
replace("The quick foxes run quickly.", "fox" => "bus")
end
end
test (generic function with 2 methods)
julia> using BenchmarkTools
julia> @btime test(10_000_000);
2.514 s (80000000 allocations: 4.77 GiB)
and
>>> import timeit
>>>
>>> def test(iter=100_000):
... for i in range(iter):
... "The quick foxes run quickly.".replace(u"fox", u"bus")
...
>>> timeit.timeit('test(10_000_000)', setup="from __main__ import test", number=1)
1.586207215