On Monday 07 September 2009 23:53:03 Robert Bradshaw wrote:
> Thanks for the implementation. I noticed that your compare was only
> comparing pointers, so if you had two equal strings at different
> memory addresses it wouldn't find them (which may or may not be what
> you'd want)
yeah, for strings, the c-alg library has a dedicated string-hash:
http://c-algorithms.sourceforge.net/doc/hash-
string_8h.html#6eb697fb58d3de146a2ddd76a1900f83

(as well as a case insensitive version)

> Also, your pointers would go out of scope as soon as test
> ended (so you couldn't return ht and use it later).
well, the C-way is to malloc everything (and c-alg's hash-table provides a way 
to register the proper 'free' frunctions)

> 
> I built on what you had to get a float -> float hashtable. Note that
> this technique only works since the float value fits inside a void*,
> anything bigger and you'd have to allocate memory manually to stick
> it into the hashtable.
right.

[..snip..]
> Not near the speed gains I was expecting...disappointing.
I (probably very naively) suspect this is coming from all the type conversions 
void*<->float
but proper profiling would tell :)

cheers,
sebastien.
-- 
#########################################
# Dr. Sebastien Binet
# Laboratoire de l'Accelerateur Lineaire
# Universite Paris-Sud XI
# Batiment 200
# 91898 Orsay
#########################################
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to