[zeromq-dev] Exact matching on subscription topics
sustrik at 250bpm.com
Mon Jan 9 23:04:37 CET 2012
> I don't understand why this would be true. All topic byte comparisons
> should be "fail fast" so as soon as a byte mismatches the code can
> move on to the next filter. For an *exact* match, if the comparison
> hasn't failed and there are no more topic bytes to examine, the match
> is exact. If a prefix match gets to the same point, it can skip the
> test to see if there are more topic bytes to compare.
> So to me it looks like the algo for topic matching is nearly
> identical except the exact-match algo has a flag that says "if we get
> to the end without a comparison failure, make one final check that
> there are no more topic bytes; if none, exact match, else fail." The
> regular check wouldn't have that flag.
The difference is in precomputing the tables for matching as far as I
can say. If you know where the key ends in the message, you can take it,
hash it and find it in the hashtable. If you are not sure what the key
is (as is the case with prefix matching) you can't do that.
More information about the zeromq-dev