|
Tei posted:gently caress speed, gently caress optimizing memory Yeah that's a luxury not all of us have. If I could spend a month to save 0.1 ms, I'd get promoted
|
# ? Nov 10, 2021 09:00 |
|
|
# ? May 26, 2024 15:24 |
|
more falafel please posted:Yeah that's a luxury not all of us have. If I could spend a month to save 0.1 ms, I'd get promoted must be interesting if i spent a month to save 1s, i'd get fired
|
# ? Nov 10, 2021 09:49 |
|
These two posts are why whenever someone goes "nobody does X", or "nobody needs X", or "you will never use math in programming", or "you will always need math for programming", I just start rolling my eyes real hard.
|
# ? Nov 10, 2021 10:07 |
|
"You don't need assembly because compilers are so good you never have to touch that. " *spends half their time trawling though objdumps and instruction traces*
|
# ? Nov 10, 2021 11:38 |
|
more falafel please posted:Yeah that's a luxury not all of us have. If I could spend a month to save 0.1 ms, I'd get promoted I am going to be honest. My first reaction was "oh, I want this dude job", ... but I guess if you have to deal with ugly code and absurd complexity + runtime weird problems, then maybe is not fun.
|
# ? Nov 10, 2021 14:37 |
|
Tei posted:I am going to be honest. My first reaction was "oh, I want this dude job", The code they're talking about optimizing is likely already very lean, vectorized, and cache optimized. Also only very specific parts of code. If I had someone who managed to cut .1ms out of the render loop from my team (not deep in the engine or renderer) it'd be an easy case to make for a staff promotion. Potentially a nice spot bonus on top.
|
# ? Nov 10, 2021 14:48 |
|
code:
code:
Somewhere outside of this. Someone didn't know how to join, so there are 4 while-loops looping over results sets and doing more queries, etc.
|
# ? Nov 10, 2021 15:42 |
|
Well, it has finally happened, I had a vendor provide us with a mutation API via HTTP GET. And the documentation didn't mention this, in fact it describes the method in English as "With this method the {thing} will be posted" And it returns 200 every time it's invoked even when the item has been already irrevocably processed. And it apparently fires off some asynchronous backend task every time it's invoked. And of course it's from a multinational enterprise consultancy corporation with literally > 1000x the number of our employees.
|
# ? Nov 10, 2021 15:57 |
|
you know that thing that some text entry fields do, where you click in them and they automatically select all the text, and if you want to just insert text instead of replace what's there you have to click a second time? does that have a name? I cannot stand it. It never fails to anger me. I clicked somewhere specific and started typing, intending to insert text into the middle of the text that was already there. But you tricked me into wiping out the text that was there. Thanks rear end in a top hat. If I'd wanted to delete all of the text, guess what? I can use ctrl+A; I'm not stupid. I use edge on this machine and it defaults to Bing for searching. I didn't give a poo poo about that until today, but Microsoft have now made a change so that the search bar on the search result page exhibits this behaviour. Not only that, but after you accidentally wipe out the text, ctrl+Z to undo doesn't work. Time to set the default search engine to Google I think.
|
# ? Nov 10, 2021 15:59 |
|
Yeah I never understood that. Let the browser handle the behavior, and if the behavior changes then people can get mad at Google or Microsoft whatever. Don't pretend like you're fancy and start loving with people's UX. Same with scrolljacking and some of those other things. Developers of those web libraries are the enemy.
|
# ? Nov 10, 2021 16:02 |
|
my blood pressure was already high enough on account of I'm trying my best to figure out how to make my additions to this horrible legacy WinForms app not look and feel like poo poo.
|
# ? Nov 10, 2021 16:03 |
|
OddObserver posted:I think someone here needs to be sentenced to spending time with STL map containers. A few ->second.first's and the desire to use these sorts of types for public interfaces flows right out of the window. code:
Problem solved!
|
# ? Nov 10, 2021 16:45 |
|
Plot twist, myMap returns its data as (value, key) pair for some godforsaken internal data layout optimization reason.
|
# ? Nov 10, 2021 17:59 |
|
Xarn posted:Plot twist, myMap returns its data as (value, key) pair for some godforsaken internal data layout optimization reason.
|
# ? Nov 10, 2021 18:13 |
|
Yeah, the STL’s use of std::pair in the map interfaces ends up forbidding all sorts of interesting optimizations like separating the key and value storage. It also used to force certain insertion patterns to be inefficient, but I think that’s fixed now (if you use new API for the insertion).
|
# ? Nov 10, 2021 18:37 |
|
If you can figure out what this is trying to do, you get an award If you can figure out why the gently caress they thought SQL was where it should be done, you get another award code:
|
# ? Nov 11, 2021 04:05 |
|
It looks like number to words. The kind that one can probably see on a cheque, such as: 1050 to "One thousand and fifty". Edit: thinking about it a bit, it could be part of a report that was generated from the database, and at some point someone wanted to have the numbers in words (banks love that poo poo) and the only reasonable thing to do was to add it as a SQL function to that report, since it had to be finished yesterday. Or maybe it would have been even harder in COBOL. To accomplish this is ugly in any programming language, how ugly it depends in what language your output should be. It looks like spanish. I don't speak any spanish, but I did have to write something like this 20 years ago (in Java) to output in Romanian. And, you're trying to find patterns (English is a lot easier for that), but at some point you just have to add the if/else or switch statements, for numbers that simply do not fit a pattern. French would be even uglier with how they speak 80-s and 90-s. It's gonna be a beast no matter what. Volguus fucked around with this message at 04:31 on Nov 11, 2021 |
# ? Nov 11, 2021 04:15 |
|
rjmccall posted:Yeah, the STL’s use of std::pair in the map interfaces ends up forbidding all sorts of interesting optimizations like separating the key and value storage. It also used to force certain insertion patterns to be inefficient, but I think that’s fixed now (if you use new API for the insertion). "std::map and std::unordered_map are actually kinda bad" pretty consistently shocks the people newer to using C++ that I've worked with. These days everyone just assumes that the standard library types must be savagely optimized and amazing and I've had to explain a whole bunch of times how some API decisions made decades ago accidentally ensured that they can't be that.
|
# ? Nov 11, 2021 04:26 |
|
What's recommended instead?
|
# ? Nov 11, 2021 04:29 |
|
Plorkyeran posted:"std::map and std::unordered_map are actually kinda bad" pretty consistently shocks the people newer to using C++ that I've worked with. These days everyone just assumes that the standard library types must be savagely optimized and amazing and I've had to explain a whole bunch of times how some API decisions made decades ago accidentally ensured that they can't be that. A real low-light is std::dequeue (and therefore typical use of std::queue), which depending on implementation can easily end up using a minimum of 512 bytes or event 4KiB for a queue which may, say, typically contain only a couple of pointers or something tiny like that. Edit: so this discussion led me on a tangent and apparently the bucket API of std::unordered_map is a thing: https://en.cppreference.com/w/cpp/container/unordered_map/bucket_size .... which I think belongs in this thread. OddObserver fucked around with this message at 05:19 on Nov 11, 2021 |
# ? Nov 11, 2021 04:52 |
|
The recommended replacement would be whatever uberlibrary framework your org already uses, probably. Pretty sure they all have alternative contains-things-but-isn't-technically-an-stl-container implementations.
|
# ? Nov 11, 2021 05:07 |
|
The funny thing is that a lot of them inherit the STL’s interface, just making weaker guarantees, so they still use std::pair to store entries and so on.
|
# ? Nov 11, 2021 05:44 |
|
Something something drop in replacement
|
# ? Nov 11, 2021 08:38 |
|
My fav is std::vector<bool>, which works differently from all other std::vector, being stored under-the-hood as bits packed into wider values. As a result, you can't take references to individual values (at least not the normal way) and concurrent modifications to different elements on different threads are not guaranteed to be safe. That last part caused a bug that took several weeks to fix on my previous job (I got to be the hero on that one because I overheard a discussion and knew about the weird behaviour due to this very thread).
|
# ? Nov 11, 2021 15:15 |
|
my favorite map pattern is when we iterate over the map looking for a specific value
|
# ? Nov 11, 2021 16:47 |
|
The worst parts of the STL are almost always the "we wrote part of the STL as an example of how to use a specific language feature" bits.
|
# ? Nov 11, 2021 16:54 |
|
elite_garbage_man posted:my favorite map pattern is when we iterate over the map looking for a specific key Fixed
|
# ? Nov 11, 2021 16:54 |
|
celestial teapot posted:If you can figure out what this is trying to do, you get an award My guess is there was a tableau dashboard somewhere that was used to present numbers to the c-suite, then someone went “Hey, I’d like those numbers turned into words; see to it by cob Wednesday”
|
# ? Nov 11, 2021 17:00 |
|
Jabor posted:The worst parts of the STL are almost always the "we wrote part of the STL as an example of how to use a specific language feature" bits. I haven’t had to touch C++ or the STL in over a decade - did they ever fix vector<bool> ?
|
# ? Nov 11, 2021 17:01 |
|
The worst part about STL is that it’s C++, and that’s a garbage language for garbage people. I say that as someone who’s used it almost every day for the last 20 or so years. Really wish the game industry had just stuck with C most of the time.
|
# ? Nov 11, 2021 17:01 |
|
chglcu posted:The worst part about STL is that it’s C++, and that’s a garbage language for garbage people. I say that as someone who’s used it almost every day for the last 20 or so years. Really wish the game industry had just stuck with C most of the time. It's before my time, so I don't really understand why games moved to C++. Especially since they do their damnedest to avoid half the things that make it nicer from a user perspective. The feel I get from C++ people when they talk to games people about what games wants to do/change in the language is "why do you even want C++ if you don't want C++"
|
# ? Nov 11, 2021 17:09 |
|
leper khan posted:It's before my time, so I don't really understand why games moved to C++. Especially since they do their damnedest to avoid half the things that make it nicer from a user perspective. The shift also happened before my time in the industry proper, but I'm guessing a few of the actually nice features gradually won people over. Of course, we all disagree on what those nice features are. My list is namespaces, function (but not operator) overloading and templates (used judiciously). That's all I really miss when I use C.
|
# ? Nov 11, 2021 17:17 |
|
DoctorTristan posted:I haven’t had to touch C++ or the STL in over a decade - did they ever fix vector<bool> ? Whether it's a standard vector or not is implementation-dependent.
|
# ? Nov 11, 2021 17:24 |
|
leper khan posted:It's before my time, so I don't really understand why games moved to C++. Especially since they do their damnedest to avoid half the things that make it nicer from a user perspective. I thought this change to C++ happened when the alternative was Java in its infancy or no real third alternative.
|
# ? Nov 11, 2021 18:09 |
|
ultrafilter posted:Whether it's a standard vector or not is implementation-dependent. In my heart I always knew the answer would be “They instead found a way to make it worse”
|
# ? Nov 11, 2021 18:16 |
|
ultrafilter posted:Whether it's a standard vector or not is implementation-dependent. No it isn't. It's not required to be more space efficient than a normal vector, but unspecialized vector<T> is not a legal implementation of vector<bool>.
|
# ? Nov 11, 2021 19:42 |
|
Plorkyeran posted:"std::map and std::unordered_map are actually kinda bad" pretty consistently shocks the people newer to using C++ that I've worked with. These days everyone just assumes that the standard library types must be savagely optimized and amazing and I've had to explain a whole bunch of times how some API decisions made decades ago accidentally ensured that they can't be that. The STL may be bad, but let me tell you, what came before it was way worse. I used to have to deal with macro based container implementations (hi HP codelibs, too bad your lovely compiler can't do templates) and libraries where everything you wanted to put into a container had to derive from a single base class (hi RogueWave). Reading the STL paper was like Jake Blues seeing the ray of light in the church.
|
# ? Nov 11, 2021 21:58 |
|
The STL is pretty amazing overall. It's just 30 years old and has a lot of little mistakes that can never be fixed because it got baked into a language unwilling to make backwards-incompatible changes.
|
# ? Nov 11, 2021 22:38 |
Can we fix it when Modules arrive? (I'm sure the answer is "no".)
|
|
# ? Nov 11, 2021 23:05 |
|
|
# ? May 26, 2024 15:24 |
|
No, the std2 idea got shot down pretty hard.
|
# ? Nov 12, 2021 03:45 |