On Tuesday, March 4, 2014 12:41:17 PM UTC-5, Ivar Nesje wrote:
>
> Part of the advantage is also possible by just declaring the type of your 
> container.
>
> *counts=Dict{SubString{ASCIIString},Int}()*
>

That speeds it up by about 20% on my machine.  I get another 25% speedup, 
bringing it close to the Python speed overall, by adding:

import Base.hash
hash{T<:ByteString}(s::SubString{T}) = ccall(:memhash, Uint64, (Ptr{Void}, 
Int), pointer(s), sizeof(s))

so that hashing a SubString does not make a copy of the string (requiring a 
memory allocation/deallocation).    We should probably fix this in Base.

Reply via email to