Hi jfroebe, sounds like you just looking for a way to speed up your hash look up? You can have a look at building your structure with pseudo-hashes, which are faster to look up.
Update: Thanks diotalevi, I wasn't aware that pseudo hashes are deprecated in 5.8, I am still using 5.6 on my Solaris box.