what is better in practice?
It depends.
A b-tree is always O(log n) performance.
A hash table is O(1) (much better than the b-tree) with
- A good hash function for your data.
- Enough hash buckets.
If those criteria are not met then the hash table will tend towards O(n) (ie. much worse than the b-tree).
Summary: good hash function: hash table will usually be better. A b-tree is consistent without needing a hash function.
In practice n is not large, and even a generic hash will be good enough to achieve close enough to O(1) that spending time on the question is a pointless optimisation.
Real answer: until you measure performance and determine that data structure lookup times are significant put your optimisation effort where your users will see a significant difference.