On Thu, 08 Sep 2011 09:16:40 -0400, Jacob Carlborg <d...@me.com> wrote:
On 2011-09-08 13:25, Steven Schveighoffer wrote:
On Tue, 06 Sep 2011 17:59:44 -0400, Jonathan M Davis
A new std.xml is already in the works. It'll be range-based, unlike
the Tango
parser. But there's no reason why Phobos shouldn't be able to have a
similarly-fast XML parser. As I understand it, the primary reason that
the
current std.xml is slow is because it uses delegates quite a bit, but I
haven't used it myself, so I don't know all of the details.
No, the issue is, and always will be, buffer access. C's FILE * just
doesn't provide anything decent. It's the primary motivation for wanting
to revamp it. With slicing and copy avoidance (i.e. only read into a
buffer, never copy out), we can achieve the same with Phobos, but I
think we have to replace C's buffering system (at least for this usage).
Tango's I/O libraries use delegates and virtual functions galore. I
think too big a stigma is attached to those. The difference between
calling a virtual function/delegate and calling a normal function is
very insignificant, the real savings for not using virtual functions is
to allow inlining.
However, in this case, I/O is so diverse that you *need* polymorphism.
-Steve
The Tango XML parser doesn't read from a file, it takes the input as a
string. The parser isn't affected by I/O at all.
So you have to read the entire file before sending it to the parser?
Isn't that a bit limited? What if I have a 50MB file, I have to read it
into a continuous memory block first?
-Steve