#code for the optimizer
Explore tagged Tumblr posts
Text
When I was younger and still stuck thinking in terms of concrete current implementations more than abstract semantics and their best possible implementations, I kept wanting to bypass the standard library, especially in low-level languages like C, because the standard library had code paths I didn't need.
If I knew I didn't need my newly allocated memory to start zeroed out, I disliked calling calloc, because a naive implementation of calloc implies extra work, and most implementations would imply extra work at least some of the time. Because I failed to conceive of the OS and hardware having extremely efficient code and circuitry for giving us zeroed out memory pages, and I failed to conceive of optimizing compilers generating code which doesn't bother zeroing out that memory if you truly never read those bytes before writing them.
If I just wanted one memory allocation for the lifetime of the program, I disliked calling malloc at all, because most malloc implementations have a complex memory allocator which is only more optimal for larger and churnier memory usage. I wanted to call the rawest, most direct memory allocation operation - for example, on modern Linux that's an mmap system call asking for an anonymous page (or for a mapping of /dev/zero, although I later learned of sloppy/overbroad SELinux policies in production, f.e. on some Android devices, which reject opening or mapping /dev/zero). Or I wanted to just manually try to grow the stack (and have raw feedback from the kernel if I didn't have enough). Because I was stuck thinking about what the concrete implementations I had on hand would do. Instead, I should've been imagining the optimizing compiler which can look at a simple "malloc", and at everything else in the code, and at any optimization preferences and other information passed in when invoking the compiler, and just compile that malloc as a raw memory system call, or as a stack allocation, if that's actually the best thing to do in that situation.
Painstakingly chipping away at this has been one of the most liberating and healing things for me as a software developer. This is why I eventually realized that we should "code for the optimizer" rather than optimizing by hand in almost every situation. But it took the overwhelming accumulation of examples of actual real-world situations where automatic optimizations beat manual fiddling, or did just as well, and where the manual fiddling was actively counter-productive.
I wish they taught this in schools or something. Just one class, one semester, which is mostly just a showcase of "here's some code. here's how it could be inefficient. how might we optimize this? yeah, yeah, cool, cool... good ideas class. Now here's what a modern compiler can do if you just give it the simple code that doesn't try to optimize. Notice how it did everything you thought of, plus things you didn't. And oh look, if we change the optimization tuning from execution speed to memory usage for example, the compiler can optimize the simple code totally differently, but our hand-optimized code is stuck using more memory, because the compiler can no longer discern the relevant intent and invariants in this code - and neither could a human, without extensive comments and context".
I know lots of developers just don't care, but it would go a long way towards either unblocking or constructively directing the type of developer who can be very productive but would otherwise spend too much time prematurely or needlessly optimizing in the wrong places.
17 notes
·
View notes
Text
the universe question
#an idea i had in the shower last month that i could not let go of aND NOW IT IS FREEEEEEE#suzaku kururugi#lelouch lamperouge#suzalulu#code geass#the colors are dark because my optimal art time is 1am and my eyes are SO tired ORZ#i just want them to be happyyyyy#people who make comics on the reg are something else TRULY i am exhausted i must go hibernate now until next year goodbye#doodle
228 notes
·
View notes
Text

i have ........... a new meowmeow fixation .........
#do any of yall kno this guy ...... do u care him .........#i watched him cartwheel for the first time and fell in love#deadlock#seven#THEY PICKED SUCH UN-SEO OPTIMIZED NAMES .#WAS IT ON PURPOSE#i jus be talkin bout anything#anyway ! dunno if ill make a catalog but ill be at animaga this weekend in melb!!#also some new stuff in my store rn#code preorderparty'll get u 10% off for da rest of the month i think#HOPE TO BE MORE ACTIVE AGAIN SOON . BEEN IN THE TRENCHES FOR MOST OF THIS YEAR#hope yallre well <3#my art
369 notes
·
View notes
Text
Today's warm up doodle, when the journey to the west has a monkie kid and it's epic
Open Arms is what would've happened had Wukong found out about Macaque training MK sooner and MK made it his mission to make them get along
#[ 🗝 ] library museum#[ 🖋 ] original works#lego monkie kid#lego monkie kid fanart#lmk mk#lmk qi xiaotian#lmk mk fanart#lmk sun wukong#lmk wukong#lmk wukong fanart#lmk sunburst duo#Open Arms striking me as Sunburst duo coded because traumatized sunshine characters handling their homies trust issues through song#It's also past Wukong and Macaque coded but it’s Wukong in the Polites role#So Wukong sees his old self in MK's kindness and optimism which is part of why he pushed MK away in this essay I will-#MK and Polites would be buddies#Meanwhile Wukong and Odysseus are sitting in their:#“Blames themselves for the deaths of others whether they caused it or not and abandoning their homes” corner
48 notes
·
View notes
Text
legacy? no babe, that’s just the trauma pipeline with extra steps. and lifelong performance review I never asked for
#dick grayson probably:#i present to you#my new nightwing playlist description#the prodigal son act gets old when you were never allowed to be anything else.#they said 'you’re the first Robin' like it was a compliment not a life sentence.#hero complex or just a kid who mistook survival for destiny?#eldest daughter syndrome#emotionally repressed but somehow everyone’s therapist#performs optimism like it’s a full-time job#has 72 unresolved issues and a fanbase that calls it resilience.#barbara: he scheduled our breakup. in a shared google calendar.#it was also color coded#nightwing#dc comics#batfam incorrect quotes#batfamily#dick grayson#dc robin#batman
44 notes
·
View notes
Text
but look at thebullshit i had to pull just to get the textboxes to tilt
and you know what they wouldn't let me put an img between box-shadow and the box so
@kumakechi thank you for your prayers
8 notes
·
View notes
Text

Leaks aren’t until tomorrow we can prepare🙏🙏🙏
And sorry to be that person but unless you can say you will not freak out in any way at the end of the manga tomorrow, I sincerely advise that you take a break. It is, of course, a superhero comic, and while I can say that it genuinely changed my own ideals about morality..or life in general—it’s still just a story, at the end of the day. It is fictional. Turn off tumblr and Twitter and tiktok, or better yet, delete them. For the day. Just chill. Have fun.
Actually, delete them today! Delete delete delete. Take care of yourself. Don’t torture yourself by going through all the anxieties and what ifs and doom scrolling.
The manga is supposed to be something fun to look forward to, it shouldn’t dictate your life if you can help it.
So good luck, have a glass of water, touch some grass, go see your mother, and I wish you all fulfillment and happiness regarding the ending.
Thank you so much mha for all the memories—so until tomorrow, goodnight!
#bkdk#togachako#midoriya izuku#mha deku#bakudeku#bkdk brainrot#bnha deku#bakugou katsuki#deku midoriya#the anxiety is only hitting tonight like damn. I’ve been in denial all week it’s kind of silly#about my own anxiety. that is. not so much what I believe in#don’t wanna belittle my own ideas or beliefs to subscribe to some benign nonsense like ‘preparing myself for the worst’#pessimism is just as blind as optimism and such#I’m not listening to my own advice though bc I have the cheat code. turning anxiety into anger.#don’t make that into a bakugou thing
32 notes
·
View notes
Text
beyblade (metal fight) and genshin fans please lend me your strength in designing a special move for Bennett and freminet I've made Bennett a balance type bey (blitz tempo) and freminet an attack type (spiral byxis) they're both on my blog I'll link it in the morning if I remember but I have an idea cooking for them but I need to assign them special moves before it can happen
#idk if this is coherent its so late and im so tired#but please#oc designers whove made special moves i value your insight as well#genshin impact#beyblade metal fight#beyblade#mfb#the brainrot got me#and turned into something bigger#yall cant understand how insane benny freminet rarepair makes me dude#i would give my left kidney for them to meet#orphans with makeshift fathers and found family#freminets depression coded character contrasting with bennetts unrelenting optimism#please im begging
10 notes
·
View notes
Text
A little example of clear abstract code "aging efficient":
if you use Arm's solution in pure software to implement pow(x,y) on an x86 machine, then it'll go 5x faster than Intel's native x87 instructions for doing the same thing. [alleged here]
If true, and I suspect it is (I would just want to verify how/why, and if any edge cases were left on the cutting room floor, just in case) then code which went out of its way to use inline assembly instead of the "pow" C function is now slower - assuming your C library or compiler takes advantage of these techniques (notably, even if there are edge cases where it behaves differently than the instruction, if the C compiler can prove that you will never hit them, or if it would be undefined behavior per the C standard to hit them, your code could benefit from this at any time).
Code for the optimizer.
11 notes
·
View notes
Note
do you have any art of ??? i feel like everyone but ???mancers are getting fed 😔

HAHAHA of course! here's a sketch i've been working on of ??? recently. i'm going to attempt to paint it so wish me luck (´ཀ` )
#anon#ro: ???#tshb sketch#tw: blood#i messed up some of the code for tshb#while optimizing it for screens#it's been two days#and i still haven't figured out how to fix it (¬_¬;)
40 notes
·
View notes
Text
beginning the qetoiles narrative playlist with undertale’s “hopes and dreams”, a very powerful and uplifting music, and later down the line having a melancholic song with the lyrics “all of your dreams / swallowed in the heat of the sun” is perhaps me cooking tbh….
#song is ‘kiltro’ — kilro btw it fucks . kiltro ouwagh how i love ur music#we’re venturing into post-canon (still on quesadilla island) hc territory with this one but its such a rock bottom qetoiles song to me .#like after qfrench tensions have finally come to light and his family breaks apart for real . after the code keeps spreading .#his dependence on CPV2 worsens . after his optimism fails to keep him afloat anymore and something breaks within him and he can’t keep#running anymore . lowest point song . and then slowly from then on out it gets better#god what would be a realistic Shit hits the fan moment in terms of etoiles’ relationship with the code vs his relationship with his friends#bc there was build up within canon with people being suspicious of his code arm his continuous use of the shield his allyship with the code#but no breaking point was ever reached . does he get corrupted by the code and lash out in a moment where he isn’t himself ? does he get to#complacent with them which leads to smth bad happening ? idk . who knows#thing is you would need to choose a narrative theme and stick to it to be able to answer the question successfully#like i tend to interpret qetoiles and cpv2/the code as an addiction thing at times . the breaking point would then have to be smth#related to when an addiction can drag you to rock bottom#jay tambles#etoiles#qfrench.posting
12 notes
·
View notes
Text
Go by the most amount of copies you own - I own three copies of stardew valley across different platforms, for instance, so I'd pick the option for three. Include digital and physical media across any platform (mobile or obsolete consoles included). As long as you own it in some way, include it
#video games#gaming#polls#gaming polls#this is my pokemon go to the polls moment#sorry for making so many polls i'm just interested in other people (nosy af)#this makes me wish for a system for people who already own a copy of a game and want to buy it on another system#if i made a game i would want to embed a unique code you could redeem#so that if you went to buy my game on another platform you could enter it and get a discount#that's probably not realistic. no fucking WAY a store like valve would let that slide. but i think it'd be really beneficial#it'd really cement you as someone who cares about their audience because some games are made for a certian platform#i can't play mobile stardew anymore because i don't feel it's optimized for mobile play#but i still bought it when my phone was my only option to play it on#and then i got it on switch as an upgrade. once i got a laptop i bought it *again*#and that's why i think a code system would be really awesome
7 notes
·
View notes
Note
How does your thing work??? I thought at first you were reading the post in as a string and doing like a key-dictionary thing to match a pattern with a Pokémon name but it didn’t do it with the Ask containing the pokérap. I am v curious and would love to hear about it if you have time
Pokemon detected :
How does your thing work??? I thought at first you were reading the post in as a string and doing like a key-dictionary thing to match a pattern with a Pokémon name but it didn’t do it with the Ask containing the pokérap. I am v curious and would love to hear about it if you have time
Ralts !
#pokemon#pokemon detector#ask the detector#okay so basically#this code is bugggy as hell for a lot of pokemon with double letters lol#but#basically i have two functions#the first parses the text depending on a pokemons name#i have a name list#and it grabs the first name and goes letter by letter to see if it's in the right order in the text i input#then the code runs for every pokemon name in the list that's the second function#it's far from optimized but so long as no one sends me the entire bee movie script it takes maybe .5 secs to run#and it returns a random pokemon from the list of the pokemon names in the text and then i have a thing that tells me if a specific pokemon#is in the list#bc sometimes i wanna be funny but a 10 lines text will give me like 900 pokemon#you can dm me for the code if you want lol it's not something i hold close or wtv it took me maybe a half hour
13 notes
·
View notes
Text
y'know, i really do appreciate the ability to overload/overwrite operators in c++. absolute 10/10 ability for a coding language to have.
#making posts which are incomprehensible to probably most of you bc i'm back on my bullshit#(the bullshit is that html sanitizer i was obsessed w/coding i think last spring; quite some time ago now)#like yeah it was FINE but it had some inconveniences n suboptimal choices or w/e#n i've always wanted to get back to fixing/optimizing that...#PLUS THE WAY SCRIVENER EXPORTS LISTS IS SO WRETCHED AND EVIL AND BUGGY#so obviously i need to write my little program to FIX THAT SHIT for me#花話
3 notes
·
View notes
Text
I found out one of my rejections is because, the program I wrote alone over 3 days, was not efficient enough.
Brother if you want anything better
give me more time
pay me
#it was three days of barely doing anything but coding and optimizing this#i should be paid unironically#ales of alex
5 notes
·
View notes
Note
soccer chef is sooo fun! I need a full version of it ASAP
question though, I made bicycle kick although that's not in the recipe book?
Thanks!!! It was incredibly fun to make and also a giant mess of spaghetti. The way I made it was a little unhinged in that I used global variables and had the game reset each time you click the pot lid
There are four dishes that were implemented but not listed in the recipe section as they weren't helpful to the puzzle solve: Hand Ball, Drop Ball, Bicycle Kick, and Kick Off--looks like you figured one of them out!
#ask#2024#for context" I have no coding or digital art experience so all three of the minigames were v much done in non-optimal ways#I learned a lot though!#I agree though; if I knew what I was doing Soccer Chef would be a fun game#I initially wanted to implement the recipes in the game itself as an unlock system but scrapped that due to timing and also the whole reset#The puzzle is partially based on 'The Wepp Perflontus Bake Off' puzzle from 2018 GPH so you might want to check that out as well
5 notes
·
View notes