News for hackers. Stuff that matters.
Re:Parsing short hexadecimal strings efficiently by LeifCarrotson on Wednesday April 17, 2019 @04:31PM (#19686254)
The only reason that you'd want to optimize this function is if it's called frequently. Imagine you you have a text file or database with millions of numbers in ASCII hexadecimal notation. When parsing that data with this code, the table is practically guaranteed to be in the cache.

Modern processors have 32 KB in L1 just 4 cycles away, hundreds of kB in L2 12 cycles away, and MB of L3 on-die cache which still only takes 50 cycles or so. I'd trust the machine to be certain to put this 256 byte table in L1. It would probably even pull the relevant parts (48-57 for the decimal digits and 65-70 for alphabetic) of a 65 KB 2-entry table if you were calling it in a tight loop. I'm curious if you could load it fast enough to sort out cache when working with a 4-entry, 4 GB table...

Re:Parsing short hexadecimal strings efficiently by dmoldavanov on Wednesday April 17, 2019 @04:51PM (#19686375)
>Imagine you you have a text file or database with millions of numbers in ASCII hexadecimal notation

These much amount of data with guarantee will crowd out this array from cache bcauz processor cache in not a LRU

Re:Parsing short hexadecimal strings efficiently by dmoldavanov on Wednesday April 17, 2019 @04:55PM (#19686404)
And now imaging an Operation System with hundreds or even thousands other processes at work.