#computertech Bot Logged User list

Network: TechNet
Modes: +ntf
Last Seen: 2 months ago
Topic:
2
Users

Channel Log Archive for #computertech

Prev
Next

* All times are UTC
Filtering by user: NiniGeo2/rizon
Thursday, December 14, 2023
[06:39:41] NiniGeo2/rizon Oh yeah in lua, eeeeeverything is like a hashmap.
[06:44:05] NiniGeo2/rizon The nice thing about a switch statement is that in theory it doesn't matter how many cases it has, the performance should be the same for a switch statement with 4 cases or a switch statement with 40,000 cases.
[06:45:10] NiniGeo2/rizon Oh I think that switch/cases are usually constant-time, not logarithmic.
[06:47:34] NiniGeo2/rizon Ooooh TYTY ski
[06:52:51] NiniGeo2/rizon Hmmmmm, I think that a switch/case is still going to end up running in constant time for most modern computer architectures because similarly to a hash table, it typically only has to do one calculation up-front at the start (very similar to hashing your key for a hash table) and then it can do a single memory read to jump to the correct case immediately.
[06:53:16] NiniGeo2/rizon Whereas a linked list or map data structure you might need to read through a bunch of different memory locations to find what you're looking for, and that certainly would scale with the amount of data.
[07:06:46] NiniGeo2/rizon :P
Prev
Next