Ontopic Random Computer-Electronics Thread

OzSTEEZ

¡ɟɟo ʞɔnɟ ʇunɔ 'ᴉO
Nov 11, 2008
34,694
9,024
473
39
Oz
Marklar
₥25,442.40
Marklar
M25,442
Nothing says I have a huge programmer ego like dumping shitty/unsafe code on a forum called "useless forums"
Or maybe arguing over the nanoseconds one's code takes over the other guy's code. Been in this argument too many times and it's one of the reasons I'm leaving coding for good.
 
  • Gravy
Reactions: Jehannum

gee

Blame It On The Gassa Nova
Sep 29, 2012
14,280
15,447
373
Halifax
Marklar
₥28,122.81
Marklar
M28,123
Or maybe arguing over the nanoseconds one's code takes over the other guy's code. Been in this argument too many times and it's one of the reasons I'm leaving coding for good.
Go look at the code I posted.

First one is gonna be as slow or slower than the original if/then/else code that got posted, which will likely compile to the same machine code as a switch statement anyway. Second code was arguably fast but unsafe as shit, and looking at it again, doesn't even work. Third code is even unsafer, and requires a 26^6 (308.9M entry) lookup table.

And the purpose of those three bits of code? to convert a state to an abbreviation. How many times does a function like that actually get hit? Is it going to remove 25% of the servers out of a data center and save megawatts of power to optimize a dumb function like that?

but nooooo, this is a SERIOUS argument about NANOSECONDS
 

gee

Blame It On The Gassa Nova
Sep 29, 2012
14,280
15,447
373
Halifax
Marklar
₥28,122.81
Marklar
M28,123
FWIW, I'm pretty sure shit like this matters for the stuff that @gee does.
Yeah, I make impossibly small stuff that has to run for years off tiny batteries.

More about saving nanoamps vs nanoseconds, but it's still a ridiculous exercise in optimization.
 

wetwille

Butt Hamster
May 24, 2018
13,423
15,442
323
60
Mid MIchigan
Marklar
₥53,753.48
Marklar
M53,753
Go look at the code I posted.

First one is gonna be as slow or slower than the original if/then/else code that got posted, which will likely compile to the same machine code as a switch statement anyway. Second code was arguably fast but unsafe as shit, and looking at it again, doesn't even work. Third code is even unsafer, and requires a 26^6 (308.9M entry) lookup table.

And the purpose of those three bits of code? to convert a state to an abbreviation. How many times does a function like that actually get hit? Is it going to remove 25% of the servers out of a data center and save megawatts of power to optimize a dumb function like that?

but nooooo, this is a SERIOUS argument about NANOSECONDS
Damn did you cats get triggered. I didn't really look at that damn code, just throwing in a little fun with an array is simpler/cleaner.