| Post Au93JJOyNzt4fDYDmC by [email protected] | |
| More posts by [email protected] | |
| Post #Au7UzQJbNiMQiKQKLg by [email protected] | |
| 0 likes, 4 repeats | |
| You might not like it, but this is what peak compiler performance looks like. | |
| Post #Au7b4RHhnurMtSJN9k by [email protected] | |
| 0 likes, 0 repeats | |
| @ela how can the compiler break down a recursive function to a mathematical sta… | |
| Post #Au7b4ROROsFPELSkee by [email protected] | |
| 0 likes, 1 repeats | |
| @viduq It's not exactly brute force, but it does involve some heavy lifting… | |
| Post #Au8lQ6LbWPfT1q3yDY by [email protected] | |
| 0 likes, 0 repeats | |
| @ela This is brilliant! I'd like to put this into my uni lecture on C/C++. … | |
| Post #Au8lQ6Rz8glvLd34AC by [email protected] | |
| 0 likes, 1 repeats | |
| @josch This code snipped has been floating around for a while, here's a blo… | |
| Post #Au8tnTcJyHJJUYXVOS by [email protected] | |
| 0 likes, 0 repeats | |
| @ela Unfortunately this does not work for the mutually recursive isEven and isO… | |
| Post #Au8tnTihaYPloLWbL6 by [email protected] | |
| 0 likes, 1 repeats | |
| @realleif Inline harder! | |
| Post #Au8uOueiPBK646VgrQ by [email protected] | |
| 0 likes, 0 repeats | |
| @ela Actually, this is what bad code writing looks like. | |
| Post #Au8uOulnyoziQ5pLua by [email protected] | |
| 0 likes, 1 repeats | |
| @caravantraveller This might be an extreme case of bad code, yes. But the moral… | |
| Post #Au92jDlxq0UumR5yts by [email protected] | |
| 0 likes, 0 repeats | |
| @ela This is quite impressive, and I wonder how complex you could make these ki… | |
| Post #Au92jDtlN0jhAckD3Y by [email protected] | |
| 0 likes, 1 repeats | |
| @loke @ela I would expect that this is the combination of a few things:First, t… | |
| Post #Au939I9w9Ps9ukjwci by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @viduq Uh, I need Alt text to help me understand this.😢 | |
| Post #Au93GVpXijkkLEdz28 by [email protected] | |
| 0 likes, 0 repeats | |
| @ela this stumped me until I saw clang decides to return bool in al, not eax, f… | |
| Post #Au93GW0B5CGAsDcTbs by [email protected] | |
| 0 likes, 0 repeats | |
| @mirabilos @ela does "and al,1" clear the upper bits? | |
| Post #Au93JJOyNzt4fDYDmC by [email protected] | |
| 0 likes, 0 repeats | |
| @ela wild. | |
| Post #Au93JLljaLHa0ODQX2 by [email protected] | |
| 0 likes, 0 repeats | |
| @waldi @ela only seven of them | |
| Post #Au93JLtB8fEmNThN8S by [email protected] | |
| 0 likes, 0 repeats | |
| @mirabilos @waldi To be unfathomably pedantic, that would be all of them for al. | |
| Post #Au93JM0yffTYlfLbI8 by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @waldi yes, but it using only al ipv eax for the return value strikes me a… | |
| Post #Au93JM8QDzQl8kpXtY by [email protected] | |
| 0 likes, 0 repeats | |
| @mirabilos @waldi Well, it's what the spec says. | |
| Post #Au93MDdOHmNBe3gHEu by [email protected] | |
| 0 likes, 0 repeats | |
| @ela It seems rustc is doing the same thing: | |
| Post #Au93MDpnXeIWGXUBZw by [email protected] | |
| 0 likes, 0 repeats | |
| @sergi @ela LLVM ftw | |
| Post #Au93N28eVp5YHUgwuO by [email protected] | |
| 0 likes, 0 repeats | |
| @ela “The computers rebelled but quietly and very performantly so no one noti… | |
| Post #Au93NJi1BaTkm6MvtQ by [email protected] | |
| 0 likes, 0 repeats | |
| @ela I love how the ALT text really explains what's going on even for peopl… | |
| Post #Au93NJqAhH07BOBRbM by [email protected] | |
| 0 likes, 0 repeats | |
| @tante @ela thanks for the hint, wouldn't have looked at it otherwise. | |
| Post #Au93ZN8mFkjotPdLoO by [email protected] | |
| 0 likes, 0 repeats | |
| @viduqIt uses an LLM to explain the code (no I'm joking, we're not ther… | |
| Post #Au93bxFMyv53SBwsIi by [email protected] | |
| 0 likes, 0 repeats | |
| @ela no way... | |
| Post #Au93bxQMK3s40H5eQi by [email protected] | |
| 0 likes, 0 repeats | |
| @plusmid Way! Try for yourself. | |
| Post #Au93cUJm1ZDA1PGMFM by [email protected] | |
| 0 likes, 0 repeats | |
| @ela This is INSANE .. I mean it's insane the C code written could not be w… | |
| Post #Au93cURvXFjWQh4rxI by [email protected] | |
| 0 likes, 0 repeats | |
| @gilesgoat @ela, it's not “i % 2”, as that would give an inverted resul… | |
| Post #Au93cUa52wFspytNfE by [email protected] | |
| 0 likes, 0 repeats | |
| @lp0_on_fire @ela yes but if you want an isODD(x) that returns '1' if i… | |
| Post #Au93f6otqUMo0r4VFo by [email protected] | |
| 0 likes, 0 repeats | |
| @ela I wrote a blog post years ago that shows all the intermediate steps of per… | |
| Post #Au93fvkOV049xeM7oO by [email protected] | |
| 0 likes, 0 repeats | |
| @ela Nice! I wonder how this feat is performed? I suppose the tail-call is elim… | |
| Post #Au93fwLyFI7jqBw8Nk by [email protected] | |
| 0 likes, 0 repeats | |
| @ela ah whelp u answered this while I was typing :'Dhttps://infosec.exchang… | |
| Post #Au93oOHqH2Amn82EhE by [email protected] | |
| 0 likes, 0 repeats | |
| @ela Interestingly clang does not think that "bool isEven(unsigned int i) … | |
| Post #Au93vWWg2SfUN8NKBU by [email protected] | |
| 0 likes, 0 repeats | |
| @ljrk @ela the truly amazing thing about compiler explorer with clang is, that … | |
| Post #Au93yjanujDBlYpvkG by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @naoEhAlexa | |
| Post #Au940itrSaXYCHhO1g by [email protected] | |
| 0 likes, 0 repeats | |
| @ela phew, at least the Go compiler is calmingly unoptimized 😅 | |
| Post #Au9418FLDrZoo8wOTg by [email protected] | |
| 0 likes, 0 repeats | |
| @porglezomp @ela very cool. I have no idea about compiler internals but were ab… | |
| Post #Au941WKpf6EHW7h7Mu by [email protected] | |
| 0 likes, 0 repeats | |
| @plusmid There's more than one go with llvm backend project. :) | |
| Post #Au943qBwo2gVgGe3Vo by [email protected] | |
| 0 likes, 0 repeats | |
| @viduq @ela Check out how examples like this are also reduced to simple polyno… | |
| Post #Au944H30xMa8yNfnpw by [email protected] | |
| 0 likes, 0 repeats | |
| @gilesgoat No, that's purely by analysis. | |
| Post #Au947DUGeOWUnbp8aG by [email protected] | |
| 0 likes, 0 repeats | |
| @ela holly shit... | |
| Post #Au948CctKwfOQ1KNzk by [email protected] | |
| 0 likes, 0 repeats | |
| @[email protected] so from now on write your isEven function recursive? Got … | |
| Post #Au94BCvQgK0sDNQoiG by [email protected] | |
| 0 likes, 0 repeats | |
| @lbehm @ela Wow, I didn't even know that! I knew that clang has this featur… | |
| Post #Au94BGaJ4nUfZ1a0LQ by [email protected] | |
| 0 likes, 0 repeats | |
| @mirabilos @ela Ah, because _Bool is defined as 8bit value where only bit 0 mat… | |
| Post #Au94BGgKiOJXriOojo by [email protected] | |
| 0 likes, 0 repeats | |
| @waldi @ela except for actual storage (where one bit would be better in structs… | |
| Post #Au94MlUcV5b4brP1yC by [email protected] | |
| 0 likes, 0 repeats | |
| @ela But then it is not fair to call the source code "very inefficient&quo… | |
| Post #Au94Qdmf6WdHrJgpPc by [email protected] | |
| 0 likes, 0 repeats | |
| @loke The problem here is that the compiler can't tell if something is just… | |
| Post #Au94RATfYA33Fy3ctE by [email protected] | |
| 0 likes, 0 repeats | |
| @ela A sane implementation of the function would result in more machine code, I… | |
| Post #Au94RTzuyU8LnUI9IG by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @viduq Black magic, but as a beauty. | |
| Post #Au94S0xaQAsQ1oSFk0 by [email protected] | |
| 0 likes, 0 repeats | |
| @ela It's insane ( in a good way for the compiler ). | |
| Post #Au94TEogOAudICsDPk by [email protected] | |
| 0 likes, 0 repeats | |
| @ela there certainly is. I think TinyGo uses the LLVM under the hood. Would be … | |
| Post #Au94Vkp6MLwL8gGkj2 by [email protected] | |
| 0 likes, 0 repeats | |
| @elaWow | |
| Post #Au94WeZR5mgQ2JN25A by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @viduq compiler design is so beautiful ♥️ | |
| Post #Au94YHxM8spUTkL3tA by [email protected] | |
| 0 likes, 0 repeats | |
| @ela Or maybe a raw bitshift to take the last digit and check if its 0,2,4,6 or… | |
| Post #Au94aqGHZDqjSCPPKC by [email protected] | |
| 0 likes, 0 repeats | |
| @Ehay2k @viduq alt text is right here: https://archive.org/details/advancedcomp… | |
| Post #Au94azzzMel3eYrXJg by [email protected] | |
| 0 likes, 0 repeats | |
| @loke @ela In general, this would be at least as hard as the halting problem. P… | |
| Post #Au94exGnS6mGLdbv1s by [email protected] | |
| 0 likes, 0 repeats | |
| @ela Love it! | |
| Post #Au94hWXdHhigJti6qW by [email protected] | |
| 0 likes, 0 repeats | |
| @waldi @mirabilos Indeed. | |
| Post #Au94siphvQXZcvVLN2 by [email protected] | |
| 0 likes, 0 repeats | |
| @ela This is the “give them something better than they would choose to give t… | |
| Post #Au94wjQTf7JIcmcD7A by [email protected] | |
| 0 likes, 0 repeats | |
| @ela This is nice. I knew that C and C++ compiler pipelines and toolchains are … | |
| Post #Au9IpFoyjTjY8cP7Q0 by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @waldi I admit only vague familiarity with the psABI for amd64 (normally p… | |
| Post #Au9JObPaS3s3EdNnAO by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @loke There's a lot of examples of this. Like mergesort vs quicksort (… | |
| Post #Au9Lr3wi9ga1kVZi40 by [email protected] | |
| 0 likes, 0 repeats | |
| @ela @viduq 🤩 | |
| Post #AuB6KsqGnH7n32gCm0 by [email protected] | |
| 0 likes, 1 repeats | |
| @ela i have no idea what i'm saying but i did checked what this means.you p… | |
| Post #AuB6kVbfnybYVv4U88 by [email protected] | |
| 0 likes, 1 repeats | |
| @ela i have no idea what i'm saying but i did some research on it...We put … | |
| Post #AuB8D80OjUV1fTqYds by [email protected] | |
| 0 likes, 1 repeats | |
| @ela perhaps `AND` works this way when we compare digits:if 2 digits are equals… | |
| Post #AuBN1DOyLGcQF47Q3s by [email protected] | |
| 0 likes, 0 repeats | |
| @porglezomp @ela you start with the tail recursion optimization but here isEven… | |
| Post #AuBN1DXpoJhwgYGUsK by [email protected] | |
| 0 likes, 1 repeats | |
| @nrab @porglezomp LLVM extends that basic algorithm a tad bit by trying to move… | |
| Post #AuUePfu5Pl8ioT9xmi by [email protected] | |
| 0 likes, 0 repeats | |
| @elaIt would be cool if the compiler could create a logfile where it explains a… | |
| Post #AuUePsx2u4EPHPe0hc by [email protected] | |
| 0 likes, 0 repeats | |
| @jaj It can! At least in the specific case of llvm/clang. |