JuliaLang/julia — comment on commit 3f753435f137cd39afb0ffbdf4fc777efb03c6dd
File:  line 0
By JeffBezanson:

The overhead is not all in `write`:

```
julia> m=memio()

julia> @time for i=1:100000; write(m,'a'); end
elapsed time: 0.005269050598144531 seconds

julia> @time for i=1:100000; with_output_stream(m, write, 'a'); end
elapsed time: 0.01262807846069336 seconds
```

`with_output_stream` more than doubles the time without doing anything fundamentally different. This is simply a design/performance point that hasn't been addressed yet.

I'm sorry. Before, the justification was that we might as well implement the full printf spec. I disagree with that, but ok, it is definitely defensible and I can go along with it. It has value. But now you are just making up extra complexity as you go along. Emitting code to check for nan and inf for every occurrence of %d is not sane, and I might as well just go make a large donation to the PyPy project. Nobody needs %d to handle NaN.

At the end of the day, if it performs well with the nan checks I guess I don't care, but we're not there yet and we have to wonder how long it will take. Seriously, all people want is the ability to type `"%.3f"` and print some columns of numbers. This is getting way out of hand.