So as a practical use of D I tried re-writing my Python program I use to process my referrer logs in D. My first pass was pretty sloppy and I end up touching every character in the file at least twice and in some cases three times. I thought I'd definitely be in need of a re-write, but the version I got working can rip through a 6MB file in 0.25 seconds, and that includes generating the HTML output.
I believe part of the speed comes from the use of 'invariant', which is like const in C and C++, but much stricter, that is, while const says a variable may not change, invariant says the underlying data will never change, and could, for example, be embedded in ROM. The other source of speed is probably D's use of non-null terminated strings. The other nice part of the code is that with bit of type inference that the D compiler does and useful expressions like 'foreach', the code was fairly easy to port from Python.
Posted by James Abley on 2007-11-28
No worries, both the creating and deleting of pastebin entries is protected by authentication.
Posted by Joe on 2007-11-28
Posted by martin on 2007-11-28
Posted by Juri Pakaste on 2007-11-28