Re: [Boost-users] Review: Switch library
[Please do not mail me a copy of your followup]
boost@lists.boost.org spake the secret code
I also urge Steven to pursue the dynamic_switch idea I posted which employs perfect hashing at compile time whereby allowing equivalent or faster than a switch dispatch at runtime where the cases are dynamic (instead of compile time constants).
I just want to say that I think this approach is so amazingly cool, my socks are not only blown off, but orbiting the planet :-). -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://www.xmission.com/~legalize/book/download/index.html Legalize Adulthood! http://blogs.xmission.com/legalize/
Richard wrote:
[Please do not mail me a copy of your followup]
boost@lists.boost.org spake the secret code
thusly: I also urge Steven to pursue the dynamic_switch idea I posted which employs perfect hashing at compile time whereby allowing equivalent or faster than a switch dispatch at runtime where the cases are dynamic (instead of compile time constants).
I just want to say that I think this approach is so amazingly cool, my socks are not only blown off, but orbiting the planet :-).
Yes, it's so cool. I believe it can be done. A well designed compiler implements switch using perfect (or near perfect) hashing anyway. Seems though that some compilers still don't. Here's the relevant link (with attached experiment code): http://lists.boost.org/Archives/boost/2004/08/69787.php Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Joel de Guzman wrote:
Richard wrote:
[Please do not mail me a copy of your followup]
boost@lists.boost.org spake the secret code
thusly: I also urge Steven to pursue the dynamic_switch idea I posted which employs perfect hashing at compile time whereby allowing equivalent or faster than a switch dispatch at runtime where the cases are dynamic (instead of compile time constants). I just want to say that I think this approach is so amazingly cool, my socks are not only blown off, but orbiting the planet :-).
Yes, it's so cool. I believe it can be done. A well designed compiler implements switch using perfect (or near perfect) hashing anyway. Seems though that some compilers still don't.
Another interesting approach could be "adaptive switch" as explained here: http://osdir.com/ml/parsers.spirit.devel/2006-05/msg00025.html (a self-optimizing alternative parser). Maybe it can be combined with hashing techniques. Regards, Tobias
Tobias Schwinger wrote:
Joel de Guzman wrote:
Richard wrote:
[Please do not mail me a copy of your followup]
boost@lists.boost.org spake the secret code
thusly: I also urge Steven to pursue the dynamic_switch idea I posted which employs perfect hashing at compile time whereby allowing equivalent or faster than a switch dispatch at runtime where the cases are dynamic (instead of compile time constants). I just want to say that I think this approach is so amazingly cool, my socks are not only blown off, but orbiting the planet :-). Yes, it's so cool. I believe it can be done. A well designed compiler implements switch using perfect (or near perfect) hashing anyway. Seems though that some compilers still don't.
Another interesting approach could be "adaptive switch" as explained here:
http://osdir.com/ml/parsers.spirit.devel/2006-05/msg00025.html
(a self-optimizing alternative parser). Maybe it can be combined with hashing techniques.
Yeah, it's a very interesting idea! Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Joel de Guzman wrote:
[Please do not mail me a copy of your followup]
boost@lists.boost.org spake the secret code
thusly: I also urge Steven to pursue the dynamic_switch idea I
Richard wrote: posted which
employs perfect hashing at compile time whereby allowing equivalent or faster than a switch dispatch at runtime where the cases are dynamic (instead of compile time constants).
I just want to say that I think this approach is so amazingly cool, my socks are not only blown off, but orbiting the planet :-).
Yes, it's so cool. I believe it can be done. A well designed compiler implements switch using perfect (or near perfect) hashing anyway. Seems though that some compilers still don't.
Here's the relevant link (with attached experiment code):
FWIW, I did a lot of work related to perfect hash generation lately (up 100 million entries in the hash table) and I second Joels request. Perfect hashs are a _very_ fast alternative to sequenced if/else if chains. The beauty of this is, that it is possible to generate perfect hashs for any type of key, not only for integer values, which again is of particular interest in dynamic switch scenarios. And I'ld be happy to help with this. Regards Hartmut
participants (4)
-
Hartmut Kaiser
-
Joel de Guzman
-
legalize+jeeves@mail.xmission.com
-
Tobias Schwinger