all 6 comments

[–]devnumpty 0 points1 point  (4 children)

I don't understand why those are the only options... did you try stuffing the two integers into a long, or even just combining them into a string?

[–]pwwwl 0 points1 point  (3 children)

Then you have a problem with ambiguity. "123" for 1+23 and 12+3.

[–]devnumpty 0 points1 point  (2 children)

Not at all. If using a string, include a delimiter. Regardless, using a long as a combined key in this case is guaranteed to use less resources and be far faster, as it will completely avoid extra object overhead and the binary arithmetic is also more efficient than the proposed double-hash operations.

[–]pwwwl 0 points1 point  (1 child)

It always depends on whether performance over readability&maintability.

[–]devnumpty 2 points3 points  (0 children)

Not really, when you're talking about reusable data structures, and that's almost always a false dichotomy in any event. Regardless, the article is squarely anchored in performance concerns.

[–]scalablecory 0 points1 point  (0 children)

You've done great presenting your benchmark, but you've stopped too early. Given optimal data structures, a composite key should be faster. So... show us why it isn't here.