<mikeX>
that seems interesting, my teacher used a hashcons module but I didn't really understand how it worked (or what it was needed for)
<pango_>
another think to look for, is that OCaml hash tables don't save hash values, so when hash tables need to be resized, all elements gets rehashed
<pango_>
which can be expensive for large sets of strings... Better give an approximatively correct size when creating the hash table
<pango_>
(or at least not too small "since it will be resized automatically anyway")
<mikeX>
ot, are private methods a new addition (>3.0.8)? I don't recall seeing any before
ikaros_ has joined #ocaml
ikaros_ has quit [Client Quit]
velco has joined #ocaml
<love-pingoo>
anybody knows how to check that a package is newer than a given version using ocamlfind ?
<flux__>
crude way would be something like ocamlfind query package -l | grep '^version:' | .. more shell here ..
<love-pingoo>
I didn't know -l, thanks. But that's still a bit crude indeed..
<flux__>
maybe -format can do something useful to remove the need for grep
<love-pingoo>
"ocamlfind query camomile -l | grep '^version:' | grep 0.[0-6]" will be enough to check that camomile isn't too old
<flux__>
try to make a check that won't break in the future :)
<flux__>
note that . matches any character
<love-pingoo>
oops :)
slipstream has joined #ocaml
Demitar has quit [Read error: 104 (Connection reset by peer)]
<mikeX>
reading the paper on hashconsing, why is "choosing a prime number is always a good idea" (for hash table initial size)?
slipstream-- has quit [Read error: 110 (Connection timed out)]
Demitar has joined #ocaml
Demitar has quit [Client Quit]
Demitar has joined #ocaml
johnnowak has quit []
l_a_m has quit [Read error: 110 (Connection timed out)]
mikeX has quit ["leaving"]
MisterC has joined #ocaml
Skal has quit [Connection timed out]
<mellum>
mikeX: It isn't, unless you have a lame hash function.
<flux__>
would choosing a prime be a bad idea then, if not taking the efficiency of dividing by 2^n into account?
_JusSx_ has joined #ocaml
l_a_m has joined #ocaml
<mellum>
flux__: no. but it would be stupid not to take that into account
Smerdyakov has joined #ocaml
Sweetsha1k has joined #ocaml
Sweetshark has quit [Read error: 110 (Connection timed out)]
jordan- has quit ["This computer has gone to sleep"]
jordan- has joined #ocaml
buluca has joined #ocaml
bmiller has joined #ocaml
kral has quit [Remote closed the connection]
danly has joined #ocaml
jordan- has quit [Read error: 110 (Connection timed out)]
velco has quit ["Ex-Chat"]
ziggurat has joined #ocaml
love-pingoo has quit ["Leaving"]
_velco has quit ["I'm outta here ..."]
mikeX has joined #ocaml
_fab has joined #ocaml
khaladan has joined #ocaml
smimou has joined #ocaml
Snark has joined #ocaml
khaladan_ has quit [Connection timed out]
bmiller has quit []
_fab has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
protoscript has quit [Read error: 110 (Connection timed out)]
bmiller has joined #ocaml
bmiller has quit [Client Quit]
Sweetsha1k has left #ocaml []
<flux__>
mellum, how many cycles is a div on a modern cpu anyway?
<flux__>
versus a suitable hashing function
<mellum>
flux__: depends. i386 has very fast div IIRC, most other something like 50-100 cycles
<flux__>
on pentium it takes about 15 cycles
<flux__>
I'd imagine less on more modern cpus..
<mellum>
nope.
<mellum>
for example alpha and ia64 don't even *have* a div instructino.
<flux__>
and how modern is alpha?
<mellum>
It' just not important, and takes heaps of transistors if you want to get it right.
<flux__>
ia64, now there's a point
<flux__>
although it appears it's an architecture soon to be extinct
<mellum>
well, alpha is about 20 years more modern than i386, for example.
<flux__>
can you buy an alpha these days?
<flux__>
without resorting to a second-hand store..
<mellum>
you're surely not going to argue that i386 is a better architecture than alpha? because that would certainly loos you every bit of credibility :)
<flux__>
I'm not sure where I was making such a claim
<flux__>
alpha was a very nice architecture, especially considering when it was designed
<flux__>
and it's a shame it didn't last.
<flux__>
but I wouldn't say that because alpha doesn't have a built-in div, one should determine that div is something bad
<flux__>
it's just something that wasn't determined to be so useful that it needs to be in the core
<flux__>
nowadays there are multiple units that can do 128 bit floating point/integer operations
<mellum>
but not integer division.
<flux__>
I think we can afford a hashing algorithm having one additional div in it
<mellum>
and floating point division is still slow.
<mellum>
It's only worth it if your hash sucks. And if your hash sucks, you're fucked anyway.
<flux__>
well, it still might be cheaper to have a nice prime div than a real hash
<mellum>
the prime stuff will mitigate it a little, but you'll run into trouble.
<mikeX>
alpha lives on partly through amd64
<mikeX>
right?
<mellum>
mikeX: how so?
<flux__>
md5, which I guess would be a decent hash, takes 337 cycles on a pentium
<mellum>
nobody uses md5 for a hash table.
<mellum>
If you want to see a really good hash table, habe a look at the Python source. They *really* thought things over. And it's nicely documented.
<mikeX>
well part of the alpha team went to amd, and they said a lot of the alpha lives inside amd64, at it's core
<flux__>
I think in the last year or so I've used 1. byte xor (2. byte rol 1) xor (3. byte rol 2) etc, it wasn't very good but did its job :)
<mikeX>
that's what I've read at least
<mellum>
For example, if you want things to be fast, you absolutely have to take cache line effects into account.
<mikeX>
hm I could be full of crap, can't find the article now
<flux__>
I too may have heard it been mentioned, that some of the alpha-team went to amd
<flux__>
but I suppose it can refer to the architecture below the level a developer sees it
<mikeX>
yes
bmiller has joined #ocaml
<mikeX>
iirc it said tha amd64 has a small risc core, on top of which x86 was implemented or something similar
<pango_>
that's not specific to amd64
<mikeX>
?
<pango_>
I think all Pentiums have such architecture, so it's a, maybe, 10 years old trick
<mikeX>
hmm
<pango_>
unless they specified something more precise than that