dcjones/Compose.jl — pull request #74 by timholy (2014-07-07 11:00:10+00:00)
Title: WIP: Add a faster version of svg_fmt_float

This doesn't show up as a bottleneck in the current tests, but if you supply bigger datasets then writing floats becomes important.

Here's a test script:
```julia
function timefmt1(io, xs)
for x in xs
@printf(io, "Value: %s\n", Compose.svg_fmt_float(x))
end
end

function timefmt2(io, xs)
for x in xs
write(io, "Value: ")
Compose.svg_fmt_float(io, x)
write(io, '\n')
end
end

io1 = open("/tmp/out1.txt", "w")
io2 = open("/tmp/out2.txt", "w")

x = 100*rand(2)
timefmt1(io1, x) # warmup
timefmt2(io2, x)
x = 100*rand(10^5)
@time timefmt1(io1, x)
@time timefmt2(io2, x)

close(io1)
close(io2)
```
Results:
```
julia> include("/tmp/timefmt.jl")
elapsed time: 0.220804141 seconds (43275084 bytes allocated, 26.84% gc time)
elapsed time: 0.02856502 seconds (80 bytes allocated)
```
and also `$ cmp out1.txt out2.txt` shows the two files are identical.

This is a WIP because I did not port many of the functions over to using it. It's a little more awkward to use than the original, since you can't use it with string interpolation. But if you decide you like this, I/we can port more functions over to using it.

I'm not planning on deleting the original version of `svg_fmt_float`---might as well have it available for cases that are not performance-critical.