5 ms·
If those utilities make up an excessively large portion of your program, C probably isn't the best choice. As long as you don't care about performance lost from
by dzaima 5y ago
If those utilities make up an excessively large portion of your program, C probably isn't the best choice. As long as you don't care about performance lost from the non-zero costs of "zero cost abstractions".
If you're implementing custom data structures, you'll likely be able to make them optimal for your use-case, both from ease-of-use and performance. (except hashmaps. those do suck to write)
- wheelerof4te 5y agoHashmaps are often overrated. I can count on my fingers how many times I used dictionaries in Python. Pretty much anything you can do with dictionaries can be much more cleanly done with classes and other built-in features. Membership testing? Use sets. Data storage? Use classes with slots or tuples/namedtuples. Custom switch statement? Use the new match/case keywords or just fall back to plain if/elif towers. It's so much simpler.
- dzaima 5y agoIt definitely depends on the project. There are plenty of domains where hashmaps are useless, and some where half the things you do need one, and many in between. The in-between is the worst - if you need a hashset/hashmap just once, you'd still have to suffer through implementing one (O(n^2) is just not acceptable). But there is a bright side to this - hashmaps are pretty inefficient if a list could do, so the more you're pushed against using one, the more likely you are to have faster code :) (as long as you don't go the O(n^2) route, that is; also, hashsets are equally hard to implement manually as hashmaps)