A lot of OSC addresses are similar, often same prefixes, etc so it’s unclear that a general purpose string hash function that assumes random strings is the right way to go. In particular, OSC messages happen in real time, there can be many of them (thousands per second) so efficient calculation is really important. There’s no way to know in advance how many distinct addresses will be needed but typically there wouldn’t ever be more than a few hundred distinct names.
Asked
Active
Viewed 33 times
0
-
Could you provide some examples addresses / link to documentation? From what I [found](http://opensoundcontrol.org/spec-1_0-examples#OSCaddress), it sounds like any hash function that mixes well is good enough (eg. Murmur hash). What programming language? – Thomas Mueller Dec 01 '17 at 08:14
-
What you found is fine --- my concern is that standard hash functions for strings may assume a reasonable amount of randomness in the strings so as to ensure greatest number of different hash values. OSC strings can be very similar, eg. /Knob1/Value, /Knob2/Value, /Knob3/Value and I wanted to make sure that I wouldn't get bitten with many collisions. – David Dec 01 '17 at 14:24
-
What you could do is test it, and if it turns out it's a problem, use a [supplemental hash function](https://stackoverflow.com/questions/664014/what-integer-hash-function-are-good-that-accepts-an-integer-hash-key/12996028#12996028). Such a hash function was / is used in the standard Java hash table, because keys of type "double" have a very problematic hash function. – Thomas Mueller Dec 01 '17 at 14:27
-
Uh, yeah, I realize that, and I'm a big fan of "if you can't measure it, it's not science". However, I'm also a big fan of "don't reinvent the wheel" so if someone has already developed a decent hash function for OSC messages, well then...... – David Dec 01 '17 at 18:35