Is there a significant difference in performance (if I'm doing random lookups), between using string and int keys? In my particular case, string keys are more convenient, but with a bit of difficulty, I could get a setup with int keys as well. I'm just wondering if it is worth the extra effort.
It is pretty clear that hashing and comparing strings is generally more expensive than hashing and comparing ints.
Whether this is of any practical significance to your particular program, we can't tell. You'll need to profile your program and find out for yourself.
My advice is to to code for clarity and ease of maintenance, then profile and only optimize the bottlenecks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With