[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1762085078499388.mp4 (879 KB, 768x576)
879 KB
879 KB MP4
previous >>108134603
>>
>>108159899
I've watched "Metal Gear Solid 4 was a mistake" too many times to not immediately recognize Golden Boy.
>>
Wish I had things to program.
>>
> hello AI pls help. THis works on chrome, but not on firefox
> This file probably doesn't exist in your setup. Let me create proper versions:

FUCK YOU FUCKING RETARD.

How the fuck do people think this is good???
>>
>>108160185
The Jews are not wrong about the goyim, many don't have a soul.
>>
>>108159899
I can't remember if this was the actual conversation or not. I just remember he's smart enough to learn it without a computer and fixes their shit after he ruined it.
>>
>>108160185
> The desktop version of Firefox, however, does not support HLS.
Why the fuck can't AI just tell me that? No instead it tries to do some weirdo fuck solution and tries me to use the botnet CDN.
What a stupid fuck. Why do people unironically believe it's good????
>>
>>108156297
>Use a compiler
But I want to learn assembly. For when the compiler does weird stuff and I don't understand what or why.
>>
>>108160394
AI oneshots entire websites for me. Literally a skill issue on your end
>>
File: øo hæoj.png (165 KB, 422x293)
165 KB
165 KB PNG
It's ironically reversed now
>C? Assembly?! *fufufufu* This is the real world, Anon, we use chatgpt to generate python and javascript here
>>
>>108160454
this, but unironically
>>
File: img.png (782 KB, 2175x1172)
782 KB
782 KB PNG
incredible things are happening in xcode
>>
>Now let me create a Makefile and README for you:
brother, I didn't ask for this. Fuck you wasting precious tokens. I hate greedy big corps. Why can't they just be normal and do what the customer wants?
>>
>>108160716
pic related would have mogged those cringe ASU faggots like no one else.
fucking CIA faggots
>>
>>108160716
your skills can't be taken away from you by corporations, but you ai tools can - in a heartbeat. your mind is also not limited by tokens. your choice to be a talentless faggot, I guess
>>
>>108160854
all of that code was written by hand though
>>
File: file.png (53 KB, 793x372)
53 KB
53 KB PNG
>400 loc for this prompt
why does claude do this?
>>
>>108161775
indians are paid by lines of code so anything web related requires lot of lines
>>
File: 1759841989013295.png (71 KB, 830x666)
71 KB
71 KB PNG
>>108161775
guess im doing it myself :|
>>
>>108161775
>why does claude do this?
That's the smoking gun!
>>
>>108161775
>please
Ok saar
>>
>>108160397
Not always - but a lot of times - it's because people came up with a broken infrastructure (say, not separating prologue, body, and epilogue from one another), and now changing it now would be too much work.

It's autism par excellence.
>the Linux kernel has the same problem btw, and everyone just ignores it
>>
>>108161871
what's wrong with asking the AI nicely?
>>
>>108162300
it costs (((them))) money
>>
>>108162401
That's a good thing.
>>
>>108162226
How do D / Rust fair?
>>
>>108162226
>it's because people came up with a broken infrastructure (say, not separating prologue, body, and epilogue from one another)
I thought the problem was precisely that the function definition was too much independent from the prologue and epilogue and therefore that compiler couldn't make microoptimizations about what is push on the stack, how many times rsp is incremented/decremented, etc... ?
>>
>>108162701
I have no idea.

>>108162860
>that the function definition was too much independent from the prologue and epilogue
Prologue and epilogue first and foremost care about register preservation and restoration. Say you have a loop in which you call foo(), bar(), and baz(). All of these functions will preserve and restore volatile registers according to the ABI.

Now, this makes sense if foo(), bar(), and baz() are outside the current module - the ABI works as intended, different modules agree on which registers to clobber and which ones not to. But if the compiler actually *has* access to all function definitions it can see that foo(), bar(), and baz() are just preserving and restoring the same values over and over and over and over again, and the only way to get the compiler to NOT do that (to my knowledge) is to inline the entire thing, and not just prologue and epilogue. And foo(), bar(), and baz() can be big and called often.

Why can't the compiler just inline prologue and epilogue? Because prologue, epilogue, and body are NOT independent entities from the eyes of most compilers.
>>
>>108162953
>preserve and restore volatile registers
Errr, non-volatile registers. Not volatile ones. Volatile ones can be clobbered at will. Which is yet another problem, but I don't feel like getting into that right now.
>>
>>108162953
Just so I interpret your post correctly, are you talking about the case where foo(), bar() and baz() are know but still need to respect the ABI because the are extern/public or you talkking about the case where the known but also static/private and don't need to respect the ABI at all?
>>
sorry for the disgusting grammar and typos
>>
File: constprop.png (11 KB, 900x280)
11 KB
11 KB PNG
>>108163078
>because the are extern/public
Yeah, so about that ... compilers have absolutely no problem creating *multiple versions of the same function* if a parameter is known at compile time. Concept's name is propagation. GCC suffixes such functions with ".constprop.<index>". Often it doesn't even make sense because the compiler still adheres to retarded ABI rules - like, if the first parameter is propagated, then the compiler will STILL shuffle around registers.
>as can be seen in picrel

If they do that, then they can also create a function version that doesn't have to respect the ABI.
>>
>>108163088
You're absolutely right!
>>
>>108159899
why is one of the girls dressed like a prostitute
>>
>>108161775
retard
>>
>>108163181
It's a sex comedy.
>>
>>108163166
>Yeah, so about that ... compilers have absolutely no problem creating *multiple versions of the same function* if a parameter is known at compile time.
Yes, mutiversioning which allows specialization in general, I've heard about that. It's just that it increases code size so it's may not be something the compiler should do everytime it can...

>If they do that, then they can also create a function version that doesn't have to respect the ABI.
yes indeed

>>108162953
I thought it would be nice to have something similar and I believe it's more than general that what you want.

In the case of a function A calling a function B where B is only called by A and where B is a closure over variables of A (it load/stores local variables of A), it would be nice to compile B to have access to A's stack frame. When B is called the return address would be pushed to the stack of course but then it would keep A's rbp. It could have local variable of its own though, for that it would decrease rsp at function entry and increase it back.

I think the proper way to deal with this is through the complier's IR. Usually, SSA instructions can only use local variable defined within the current function. If it could have a notion of environment (free variables, variables visible to the function but in an outter scope), the register allocator could allocate A and B function's body at the same time. This means that if a local variable of A used by B is already allocated in a register, then B can use it directly without shuffling. Effecively epilogues and prologues no longer exists, scratch register are no longer a thing and restoring registers is dealt just normal spilling/reloading.
>>
>>108163188
proof?
>>
I was hired to modernize a legacy Java banking app with a small, long-term team. The app is painfully slow and dated. Surprisingly, my senior dev buddy supports updating it, but I want to ensure the rest of the team feels respected rather than forced.

My background is Next.js/TS. A friend in fintech loves Kotlin, and I’m considering pushing for that. I don't know the language yet, but it seems like the perfect middle ground since it is fully interoperable with their existing code and much easier for Java devs to adopt.
>>
>>108163533
third time's the charm on this question. You'll get the answer you want one day. Keep trying! Keep finding a new way to ask! Definitely do not anything boring or that requires effort, like "actually learning anything". Put your effort into words, not learning! Expression, not labor! You are an artist! You are above having to learn things!
>>
>>108163166
The abi only needs to be respected around system and library calls, a function like id(x) = x should simply evaporate
>>
Is learning Rust and leaning hard into it gonna make it easier to get a job at all
>>
>>108163533
Why repeat?
>>
>>108160224
it's unedited
>>
>>108163813
if you want to drown in delusion, read https://www.linuxjournal.com/article/3882 and apply it to Rust.
NB. at this time Python was merely yet another scripting language and grossly inferior to Perl both technically and socially.
if you the red pill, 100% of time spent on caring about programming languages is wasted. At best you could argue that you can be worked in a sweatshop to mindlessly milk code from AI and that Rust is a better cow-language because it has stronger compile-time guarantees that are easier for you to audit.
>>
>>108163533
you were hired wrong
>>
>>108163529
https://www.youtube.com/watch?v=93-_r0w7ykI&t=9569

>>108163459
>It's just that it increases code size
And compiler devs don't care, as is evident by the fact that most optimization improvements in the last couple decades have been focused on inlining the shit out of code - even if it makes no sense whatsoever.
>what's that? the module's size just increased by a factor of ten? fuck it, ship it

>it would keep A's rbp
Base pointer elimination is a tried-and-tested optimization - to the point that, when clang doesn't do it, it's considered a bug.

>>108163561
Maybe, *maybe* if you have LTO enabled, you *can* get away with object files in your own project. But if it's compiled already: lol no. ABIs exist for a reason.
>>
Is bottom-up dp really the final boss of raw programming skill?
>>
>>108164973
no it's not you fucking faggot
you think your gay algorithm is more difficult to write than the video player you use everyday? game engine of your favorite game? emulator? compiler? kernel?
>>
>>108165315
>game engine of your favorite game?
Tons of games cannot cleanly separate their graphics state from their game state. That's why so many of them require a restart if you change some graphics settings.

>emulator?
I don't think I've ever read emulator code I had no complains with. It's shocking how often they copy shit that doesn't need a copy, to say nothing of the copy policy in question (temporal or not)

>compiler?
>>108162226

>kernel?
Most of it are self-inflicted gunshot wounds because kernel devs are mentally stuck in the 1970s.
>do we learn from graphics programming and use front and back buffers for command submission?
>no, we allow people to add jobs while the kernel is still completing them and
>fuck, where did all these CVEs come from?

And that's not to say that hardware engineers didn't fuck up shit either. The introduction of multi-core processors *at the latest* should've seen some sort of thread-local page table permissions for zero-copy submissions without global TLB shootdowns.
>>
>>108165315
lots of people think that way, and it's very obvious that people think this way if you hear much AI hype. It's all like a slave plantation owner buying humanoid robots from China to pick cotton the same way that the slaves did, such is the plantation owner's contempt for the slaves and the slaves' labor.
>>
Why is learning programming so fucking cucked, I don't want to touch or interact with git/github, I just want to press Ctrl + S and save my file and if I fuck up press Ctrl + Z. And oh my fucking god why is vscode so fucking retarded, I want to just start typing when I open a program why do I need to go through fucking hoops to use a discount bullshit ass file system navigator to get to test_project.py or why does vscode try to fucking guess what coding language my project is in. Deadass I'm about to learn Assembly instead of Python, I want to code and not rely on python guesstimating what I'm asking for and then telling the computer in the same way assembly does
>>
>>108165645
What makes you think Python is guessing what you want it to do? It just goes through the same nonsensical abstractions every single time.

You have the same shit with out-of-order execution. People believe it's fucking magic.
>>
>>108165645
You are incredibly ignorant.
>>
>>108164769
>>108165786
>>
File: 101.jpg (707 KB, 1891x1200)
707 KB
707 KB JPG
i'm a self taught programmer so i don't really have fundational knowledge that i otherwise would have learned by going to college.

i stumbled on a data oriented design talk a couple of weeks ago and now i've been reading on it and how it tries to model and work with data in a CPU friendly way (muh cache misses, cache line, l1, l2, etc shit i also just learned this month).

are concepts like these shit that everyone is just expected to know in a professional work environment? i have a job at a web company so i guess with the tools and programming languages i work with on a daily basis, being so high level, maybe all of this is obfuscated somewhere inside the dozens of framework and library abstractions our projects depend on. or maybe webdev being the bottom of the barrel as far as programming goes people in these jobs aren't expected to care or know about CPU cache and whatnot.
>>
>>108165645
You could have asked literally anyone with a brain and they would have told you that python sucks. Just learn a better language. Ctrl+s and ctrl+z work fine on my machine.
>>108166022
If you ever tried to use a computer in the past 20 years you know that nobody cares about performance. Most programmers aren't even in a position where they could make use of that knowledge even if they had it.
>>
>>108159899
I want those women to humiliate me and rape me.
>>
>>108166022
99% of companies don't give a shit or educate their employees about data oriented anything, center the damn button already.
>>
>>108166022
If you are trying to optimize code always measure and compare solutions.
90% of the time there are unexpected things what rapes your intuition.
>>
>>108166119
>nobody cares about performance
No, that's not true. The entire async craze was originally born out of the observation that single-threaded performance was not going to improve much more (Dennard scaling), and that processors would have two or more cores in the future.
>in exchange for massively increased memory requirements
>which are now dropping on people's feet like a massive hot potato

And what we have now is what we will have for the next couple years or even decades, until we make a breakthrough in material processing that allows us to make sub-atomic transistors without quantum tunneling (which is a tall ask). My only question is if people will continue to pay through the nose for subpar quality or not.
>looking at all the unemployed IT bottom feeders though ...

>>108166022
>maybe all of this is obfuscated somewhere inside the dozens of framework and library abstractions our projects depend on
Have you tried stracing one of your projects, and see what it does? That's where I'd start.
>>
File: what the fuck?.png (217 KB, 795x1014)
217 KB
217 KB PNG
>>
>>108159899
I feel like I wasted the past 6 years programming. I've been alone weekdays and weekends, ignoring everything else.
>>
>>108167738
>bit manipulation and backtracking
how the fuck is this an "easy" problem?
>>
File: 1704925623496988.png (1.26 MB, 1230x1434)
1.26 MB
1.26 MB PNG
>>108167738
I hope I'll see your post the day you stop doing leetcode and want to start writing a real software only to realize that all the time your spent gaining leetcode "experience" doesn't translate to actual programming skills.
>>
>>108167798
you just precompute all the answers and hardcode them.
>>
>>108167798
>bit manipulation
trivial
>backtracking
start by counting up from 0 and filtering by number of bits set.
>>
>>108167803
I solve multiple of these leetcode problems a day because I find it fun, and it's what interviewers care about. I already know it doesn't translate to real world programming skills, but that's because 99% of real world programming (including my stack) is frameworkslop and not low level algorithm design.

Despite that I still enjoy these thought problems (not that one, fuck that gay retard watch) and I have noticed my programming skills improving and my thought process changing as I solve more of these exercises.
>>
>>108168001
>because 99% of real world programming (including my stack) is frameworkslop and not low level algorithm design
Maybe, but I'm going to bet money it's bad framework slop.

Or did you actually trace what your applications do internally, on a syscall level? Because let me tell you, that changes perspectives dramatically.
>and I'm never going to be using fopen or CreateFile again
>>
>>108160185
skill issue
>>
File: 1767365122178223.png (55 KB, 230x300)
55 KB
55 KB PNG
>current application binary is 9.8mb
>have a complex task that requires web scraping
>could use a dedicated webscraping package that's like 15mb and has 80% accuracy
>or I could download a 350mb bert ml file and get 95% accuracy
sorry end users, my resume needs "AI integration experience"
>>
>>108168234
>get 95% accuracy
Says who?
>>
Am I insane or are modern ISAs niggerlicious? I've done ASM on retro stuff and wanted to get into big-boy programming on modern hardware, but I'm having difficulty not vomiting reading the x86-64 or AArch64 manuals. Too many registers, too many instructions, bizarre data structures, vestigal growths where the architecture was dragged from one idea to another, it's just awful.
>>
>>108168251
>Too many registers
I prefer that over the shadow register nonsense, where you need a big ol' register renaming unit to manage your dependencies.
>or, as AMD has secretly tested, memory renaming
>>
File: Capture.png (117 KB, 775x646)
117 KB
117 KB PNG
I've reached the Zen stage, guys. Have you?
>>
File: 1742333680218324.png (219 KB, 432x621)
219 KB
219 KB PNG
>>108169222
why does AI do this shit every so often
stop the meat riding
>>
i keep trying to do c++ shit in python
>>
>>108169222
Years ago.
>>
Whenever I see some basic/tutorial C++ code, I'm always reminded of how fucking insane it was that they thought cout << "blah" << endl was a good idea.
After 40 years of bloat piled on top of bloat piled on top of bloat, have they really not added anything better that isn't just calling printf?
>>
>>108169322
for me it's system.out.println()
>>
>>108169322
You make it sound as if autists have the ability to change their minds.
>>
>>108169259
What does this mean? You keep trying to bloat python?
>>
>>108169434
yes, because i first learned basics with c++
>>
File: bluray.jpg (31 KB, 1000x424)
31 KB
31 KB JPG
>>108159899
Shit thread.

I am cleaning up my project. Release is very soon!!!
>>
>twenty files named "deletemeXXX.py" dating back almost a decade
>never deleted any of them
>>
>>108169984
not my fault.
>>
>>108166022
Not everyone but if you care about performance sure. E.g. there is really no point in using low level languages if you will not optimize your cache locality at all.
>>
>>108167798
There was a time when you learnt bit hacking in your very first lecture.
>>
>>108159899
lmao what a pseud OP
>>
>>108160419
>>108168171
do you sincerely believe you're better at "prompt engineering" than that guy and it makes enough of a difference if you were working on the same problems. Clearly he has a different usecase from you. Rethink your posts
>>
I wish I could delude myself into believing I was a decent programmer.
>>
I removed all browsers from my tablet because I wanted to only use it for reading books and manga, but I still wanted access to danbooru, so I made an apk with kotlin that uses android webview to give me access to danbooru but block other sites. Now I need to figure out how to add browser-like tabs. I feel like there's a much easier solution, but whatever.
>>
whats the best compression tool for long term archiving?
not a plain block compressor like the lz huffman variants but one that also does deduplication & other intelligent (possibly format-aware) redundancy reduction
>>
Instead of doing anything productive, I was wondering how/if languages would be different if standard keyboard layouts had an infinite symbol.
>>
>>108171177
Consider zpaq maybe. That's what I use for rarely accessed big sets.

>>108171099
I know in my heart that all programmers are bad. (Me too.)
>>
Codex in my vsc ide is revolutionary. I finished a project for my Django course in college in about 2 hours when it should take us 1 month of work to complete. But I'm not learning shit. At the same time though if I am passing with AI then surely I can use AI in the real world when I graduate.

I can read and write code in an already established project but I cannot write shit from scratch besides front end. Is anybody like this?
>>
>>108171260
>I cannot write shit from scratch besides front end
You are fucked
>>
>>108171268
I'm actually better in IT related fields like network engineering and website maintenance. My internship this summer involves website maintenance and I got a job at my university helping the IT guys out (mainly doing grunt work) which is why I've also minored in IT (if it isn't obvious yet I am majoring in CS)

Traditional SE/programming jobs seem like a fruitless future for me.
>>
>>108171260
>I'm not learning shit
>At the same time though if I am passing with AI then surely I can use AI in the real world when I graduate.
I'm gonna say this. School homework problems are obviously very old and very well understood by now, they are fundamentals.
In the real world you are going to have to often solve problems that have not already been solved, and can not be "looked up" in the modern sense "generated".
Obviously it's very good at copy pasting the answer of 2+2, a problem as old and published as time itself. But what about solving my real world new problem that nobody has ever encountered before? Something actually important enough for an employer to pay someone to solve.
In the event the employer doesn't have those kinds of problems, the issue still is why would they pay you when they have the same lack-of knowledge of programming and the same level of access to AI, as you do.
Maybe things will be fine for you but I guess its worth considering the risk when it comes to school. That's your time and money, as well as your future. Might be worth taking seriously, whether its for programming or something else that you actually want to engage with every day for your professional life several hours a day.
Faking works great for academia because schools get punished for high failure rates so they want to pass everyone anyway. In the working world business close if they're filled with fakers and cheats, they have real money that really runs out with real customers that want real products that really works, not just theoretical exercises that everyone has already seen before.

I say this not to discourage you, just be cautious.
>>
>>108171460
You're absolutely right. I only really majored in CS because my actual interests get paid like shit in the workforce, and I don't want to spend 10% of my life getting a PhD. It sounded easy, especially because I've done web design in highschool, but... I didn't realize how easy it is to cheat through your work. Sounds like a cope, probably is a cope, but it is what it is.

It's sort of fucked up because I've AI generated most my work that requires more than 2 hours to complete lol

I do actually enjoy IT to some extent, which is probably what I'm going to fall back on with my minor and certifications when I inevitably get fired for being a replaceable codemonkey, that is if I ever even get past an interview.
>>
How many (You) do you get per week from friends?
Sometimes I get 0 per month. But I see normal normies on the phone all the time. They all get messages or calls constantly.
>>
>>108171916
My grandma calles me twice a week

Anyways I thought that I would have to do custom widgets on qt for list/card view with pictures but it looks like qt handles that automatically which is very nice
>>
File: minus-package-manager.png (51 KB, 1382x638)
51 KB
51 KB PNG
I'm working on my programming language and a package manager for it & other projects of mine.
>>
>>108172059
>my programming language
post what it looks like
>>
>>108171311
Y'all niggers apparently can't even do simple straces.
>>
File: builder.min.png (31 KB, 842x562)
31 KB
31 KB PNG
>>108172189
Here's a simple script for building the language for 4 different targets. The language also supports user-made functions, various loops and pretty much all the Python features except classes/objects. It also can handle concurrency much better than Python and has pool & process statements as parts of its syntax.
>>
>>108172848
100% of this is AI, right?
>>
man, how can people read assembly, I just don't get it
even just calling a function is a pain to identify, you can easily spot the "call" but recognizing the argument list is hard, and for anything anything else my eyes just gloss over without registering
even loops are hard to track
>>
>>108172853
You mean if it's vibe-coded or not? I'd say about 5% of this project's code is from an LLM, the rest I did myself.
This is the 4th rewrite of it and I had the original idea actual years ago, so it took some time to get here.
>>
>>108161775
>liquid ass style
You forgot the microbikini sir.
>>
>>108172900
>but recognizing the argument list is hard
isn't it just a matter of looking at the push & store instructions immediately before the call?

>t. not an assembly geek either
>>
I am so fucking tired. All text editors fucking suck.
I have even been trying fucking vscode out of desperation and of course it also sucks. And every time I get close to the point of feeling comfortable enough, I don't even start working. I hate this. It even feels like it reflects on other areas of my current life. Wish I picked another career path. Wish I was a soldier or a cop or something.
>>
>>108159899
Coding as a hobby is so comfy when it is not your primary job.
>>
>>108173485
>Wish I was a soldier or a cop or something.
lol wut
>>
I'm working on a personal project just a file management system, I built something ages ago that works but I want to refine it. Previously, I was just using h2 database and filesystem for file storage. I'm thinking of switching to postgres as I'm going to turn this into a server side application but I also want some sort of blob storage docker container image? Effectively some sort of database for files basically like a local amazon s3 I can self host via docker. I know these blobstores exist, but does anyone here have a recommended free product I should use. Like when it comes to DBs I just default to postgres because it just works, what's the equivalent no nonsense thing for a blobstore.
>>
>>108173472
>push & store
Modern ABIs use registers to pass parameters. 4 on x64 Windows, six on Linux.
>that's why Linux syscalls are limited to six parameters
>because the kernel developers didn't want to copy userspace stack data to kernelspace
>>
>>108173815
Also
>push & store
are their own can of worms on x64.
>PUSH/POP are one-byte opcodes
>because the x86 designers thought they would be used all the time
>years pass
>out-of-order execution happens
>suddenly PUSH/POP have a dependency on the stack pointer register and can not be executed out of order
>thus compiler developers start generating MOV instructions with stack pointer + displacements instead
>much bigger instructions, but muh OOO
>years pass again
>CPU designers get smart
>get the processor to execute PUSH/POP instructions out of order as long as they're in consecutive blocks
>suddenly PUSH/POPs are preferable again
>compilers issue PUSH/POPs now
>and no one wants to talk about twenty years of MOV instructions

In fact MS baked the concept of shadow store into their fucking ABI: >>108162226
If a callee now wants to make use of that stack memory they cannot use PUSH/POP because the store is located BEYOND the return address, so they HAVE to use MOVs.

If these autists could feel embarrassment they would've already killed themselves.
>>
>>108172848
I cringed so hard that I felt physical pain
>>
>>108172848
Wrong reply, was meant for the AI slop post above, sorry for being rude.
>>108175303
>>108169222
>>
>https://en.cppreference.com/w/c/atomic/memory_order.html
damn this is no joke
the benchmark pthread_create-s 2 threads that acquire a mutex, increment a counter, release a mutex. Each thread does this 100 millions times.
1st vs 2d implementation takes 9.5-10s vs 3.5s at -O0, 6.4s vs 2.7s at -O2

struct mutex {
_Atomic bool lock;
};

void mutex_init(struct mutex *mutex)
{
atomic_store(&mutex->lock, false);
}

/*
void mutex_acquire(struct mutex *mutex)
{
while (atomic_exchange(&mutex->lock, true)) {}
}

void mutex_release(struct mutex *mutex)
{
atomic_store(&mutex->lock, false);
}
*/

void mutex_acquire(struct mutex *mutex)
{
while (atomic_exchange_explicit(&mutex->lock, true, memory_order_acquire)) {}
}

void mutex_release(struct mutex *mutex)
{
atomic_store_explicit(&mutex->lock, false, memory_order_release);
}

struct mutex mutex;
uint64_t counter = 0;

void *incr(void *arg)
{
(void)arg;

for (size_t i=0; i < 100000000; i++) {
mutex_acquire(&mutex);
counter++;
mutex_release(&mutex);
}

return NULL;
}
>>
>>108175470
>first implementation generates an actual XCHG, requiring a read and a write for
>second implementation generates a simple dumb MOV that can be scheduled whenever
>anon is essentially measuring his L1 cache read speed
>>
>>108175470
in OCaml this is just (twice as slow, 10x as many instructions, 11x as many branch misses)
let counter = ref 0
let lock = Atomic.make false

let rec wtf_busywait_acquire () =
if Atomic.exchange lock true then wtf_busywait_acquire ()

let mutex_release () = ignore (Atomic.exchange lock false)

let incr () =
for i = 1 to 100_000_000 do
wtf_busywait_acquire ();
incr counter;
mutex_release ()
done

let () =
let thr = Domain.spawn incr in
incr ();
Domain.join thr;
Printf.printf "done: %d\n" !counter

with a Mutex the cache is a lot better, but branch misses and instruction count get even more catastrophic

meanwhile this has less than 1% the branch misses of C and 25% the runtime:
let counter = Atomic.make_contended 0

let incr () =
for i = 1 to 100_000_000 do
Atomic.incr counter
done

let () =
let thr = Domain.spawn incr in
incr ();
Domain.join thr;
Printf.printf "done: %d\n" (Atomic.get counter)

OCaml proven FASTER than C.
>>
>>108175648
add 100000000 i = i
add n i = add (n + 1) (i + 1)

main = do
let work = add 0 0
putStrLn "done 100000000"
>>
>>108175668
Haskell anon is obviously too lazy to understand the problem or what the expected output is
>>
>>108175648
>uses a 64-bit value instead of a 1-byte value
>>
>>108175700
doc for make_contended:
>If multiple atomic references share the same cache line, modifying these disjoint memory regions simultaneously becomes impossible, which can create a bottleneck. Hence, as a general guideline, if an atomic reference is experiencing contention, assigning it its own cache line may enhance performance.
>>
>>108175717
... are you ... confusing 64 bytes with 64 bits right now?
>>
I vibe koded this. Can you please review???

package main

import "fmt"

func main() {
fmt.Println("Seahorse (ASCII):")
fmt.Println(`
\/
/o\
/_/
/ /
\_\
|
`)
fmt.Println("Emoji: (Dragon is the closest substitute)")
}
>>
>>108175732
I .... am ..... wondering what the point could possibly be in saving 7 bytes for a scalar value, when this whole feature exists to waste more than that.
>>
>>108175743
Native word size. Smaller sizes may require masking.
>>
Error handling POSIX IO code is just abysmal.
>>
nowadays they'd all be troons and they'd use rust
>>
File: images (1).jpg (13 KB, 322x157)
13 KB
13 KB JPG
Does the design pattern of a script that runs versions of same command multiple times call for a monad

It should fail if it the command fails at any point
>>
You can't just say monad when you don't know a thing.
>>
Do you want to explain this obvious thing that's obviously wrong.
>>
>programmers were better back when they were mathematicians
coincidence?
>>
>>108177509
When was that exactly?
>>
>>108177509
wrong. programmers were better back when they had unlimited money and the single directive of "make shit to make communication better"
>>
>>108177536
When John Pentium invented the first CPU, do you think people were already standing by with PhDs in software engineering?
>>
>>108177612
Answer the fucking question.
>>
File: 1746054300990676.png (134 KB, 760x780)
134 KB
134 KB PNG
>>108177660
Concession accepted.
>>
>>108177761
That's my line.
Programmers were just as retarded as they are right now, and there's nothing you can do about it.
>>
File: ancientprogrammers.png (28 KB, 592x218)
28 KB
28 KB PNG
>>108177536
>>
>>108177807
Did he ever denounce later kernel developers for adopting an interface that he had originally developed for a machine that used tape as mass storage?
>>
>>108177825
>c depends on the storage medium
you need to go back
>>
>>108177834
>he thinks we're talking about C here
You belong in a cage.
>>
i barely touched code during the last 10 years, and i decided to try cursor for fun. i made an app in like 3 hours that would have been a senior semester project in uni like 5 years ago
>>
>>108177880
>i made an app
But you didn't.
>>
>>108171916
I can't even pretend to understand what people talk about when they call each other every day.
Like is it just "hey, what are you up to?" "nothing lol" "okay".
>>
>>108177825
He's quoted for saying Linux retarded OS development by a decade or more, which is accurate. He designed the OS in the 70s but Linux reimplemented that design in the 90s well after others innovated in the OS space in the 80s. And here we are in the 20s still stuck with those interfaces as a result of Linux adoption / stagnation.
>>
>>108177929
Link?
I'm not doubting you, I'd just like to have a reference.
>for a friend
>>
>>108177934
I don't actually remember the source, it may have been a book or it may have been on a mailing list.
The problem is "retarded" in the literal sense makes it hard to search for because of search engine bullshittery.

The quote text should be:
>Unix has retarded OS research by 10 years and linux has retarded it by 20.
>>
>>108177951
>Unix has retarded OS research by 10 years
I mean, I am willing to cut UNIX some slack, I really am. The constraints of the time were fucking insane.

But I have absolutely no mercy for either NT or Loonix. Fuck these shitkernels.
>>
>>108177997
Fully agree. Unix is an amazing first generation / epoch. But when was the last time your first attempt was the best implementation?
The people who shit on Unix the hardest seemingly have always been its own authors, which makes sense considering they made Plan 9 not long after which is magical in comparison.
>>
File: yeah.png (385 KB, 960x789)
385 KB
385 KB PNG
>>108178004
>But when was the last time your first attempt was the best implementation?
Yeah.
>>
>>108177888
results are all that matter
>>
>>108178042
>>108172221
>>
>>108178059
>>108178042
>>
>>108178110
>>108172221
>>
>>108178042
>git clone
>cmake
>make
I made an app!
>>
>>108175684
and too tired to bother making something multi-threaded and reply-anon is too dumb to get the joke
>>
File: file.png (21 KB, 474x304)
21 KB
21 KB PNG
>all the leetcode questions this week are bit manipulation garbage
pain
>>
why is go so much fun? I dont really get it.
Maybe because it's just because it feels like C, but with GC fun.

>muh branelet error handling complaint
go kys()
>>
>>108178018
>muh POSIX io bad. It doesn't even have easy parallel io
just write better software
>>
>>108163996
What show?
>>
>>108178394
Asking that question on 4chan should be a bannable offense, or at least a warning. I'm joking, obviously, but just reverse search the file.
>>
>>108177880
> i made an app in like 3 hours that would have been a senior semester project in uni like 5 years ago

No wonder why college graduates are useless.
If AI can write your software, it's because your software is worthless trivial garbage.
>>
>too tired to think of how to create an algorithm I need
>use Google ai to get something good enough
>come back later and whip up a better one in 10 minutes using my own brain
I feel dirty
>>
>>108178448
I had the same with lots of VHDL shit. Conclusion is that gemini is really utter fucking garbage and I hate google for tricking me into their SPECIAL OFFER.
Well, at least now I know and it somehow keeps me motivated. I have someone to prove wrong
>>
>>108178448
buy an ad
>>
>>108178411
>>108178192
have you not used cursor? this is insane cope
>>
File: debian.png (795 B, 80x80)
795 B
795 B PNG
>>108178530
buy an rope
>>
12pm. Time for lunch!
>>
File: refl.jpg (153 KB, 1600x900)
153 KB
153 KB JPG
>cat-ears operator
haha, so cute
>>
>>108179486
How many more operators do they need?
Sometimes I want to do more C++, but I am not sure if I want to deal with one trillion operators
>>
>>108179595
just don't use it
>>
>>108179678
I have to sooner or later.
Webshit is much worse and I don't want to do that. Rust will not take over that fast in embedded systems adn C++ gets used quite heavily. There is still a lot C, but it's getting less
>>
>>108178391
That people laugh at you IRL - that's a given.
But why do you insist people do so on 4chins too?
>>
>>108180157
I like the (You). It helps me a lot.
>>
>>108180275
You're so ugly you don't even get male attention IRL? Fuck.
>>
>>108180389
I do get attention from a 63yo ukrainian girl. She wants a (foot) massage and baileys
>>
>>108180426
Let me guess - "she" was in the cleanup crew in Chernobyl?
>>
>>108180496
No, she fled from a real war and now she's getting her pussy licked from an insecure nerd. That must be some heavy trauma
>>
>>108180562
>she
>real war
>pussy
>trauma
Why are you lying so much?
>>
>being this jelly
top kek
>>
>jelly of 63yo pussy
Autists belong in cages.
>>
>>108177825
>a machine that used tape as mass storage
Apart from seek(), what else? readdir()?
>>
>>108178706
buy a parachute
>>
>>108182093
Parallelism.
>open operates on one file
>read operates on one file
>write operates on one file
>close operates on one file
Which was OK for UNIX, but already completely outdated by 1982 - when protection rings were introduced with the 286 - or 1989 - when pipelining was introduced with the 486 and TCQ with SCSI-2.
>>
did the cppreference guy suduko or something
when is it getting updated
>>
>>108182357
What would the function signatures be with parallelism?
How would you deal with concurrent accesses of the same file/directory and how would synchronization work?

I fail to see how protectiong rings and pipelining has to with a filesystem supporting concurrency.
>>
>>108179486
That example even looks so fucking cumbersome and elaborate.
Like yeah, I accept I'm just an unexperienced junior but isn't that rarely needed and probably done in a way easier fashion in some other language?
>>
>>108182634
>I fail to see how protectiong rings and pipelining has to with a filesystem supporting concurrency.
1. Protection.
2. Ring switches absolutely stall the pipeline until all loads and stores have been retired; they're not a simple CALL, where certain writes may still be in flight. SYSCALLs are one of the most expensive instructions in x86-64.
3. The problem with file systems is particularly the submission - more so back in the day because concurrency was implemented via a single submission queue that had an entry depth of, say, 32 entries. When the queue was already working on a submission you couldn't use another one, because it didn't exist. Wouldn't be until NVMes where that particular bottleneck was resolved, because both TCQ and NCQ only ever supported a single queue.

But then there's internal batching.
1. Introduces latency one way or the other (either the first submission waits, or all subsequent submissions wait).
2. Submission interfaces are often still single-job or single-file only (see the fuckup that I/O completion ports are, which are single-job only, or ReadFileScatter/WriteFileGather, which do support multiple jobs, but only on the same file handle, and only ever read OR write).
3. It's error-prone and requires locks.

>What would the function signatures be with parallelism?
At that point we wouldn't want to talk about parallelism, but about kernel design philosophy - i.e. providing actual monolithic kernel interfaces that would look a lot like command buffers in Vulkan. I mean, the entire thing is already running in the same address space; why wouldn't you want to supply work for its multiple subsystems?

>gotta say, not a bad post for half a bottle of vodka running in my system
>>
>>108182870
>isn't that rarely needed
yeah, most C++ devs won't touch this ever. but it's a big deal for anyone who does a lot of metaprogramming (mostly library devs).
>done in a way easier fashion in some other language
probably. but this doesn't matter much for C++ devs.
>>
File: 1768575022246471.png (579 KB, 736x736)
579 KB
579 KB PNG
should I start learning C++ or Rust?
>>
>>108183146
I somehow doubt Rust is better than C++.
>>108169288
>>
>>108183146
stay away from Rust.
>>
>>108183146
what do you want to make? what languages do you already know?
>>
>>108183178
Make?
>>
>>108183243
Haskell then
>>
>>108183178
>what do you want to make
money
>>
>>108183258
pick up plumbing. we're full.
>>
>>108183258
go learn a trade. its in high demand
>>
I don't remember Visual Studio being this obtuse.
>>
>>108183375
Reason why you have to use VS, and not msys2?
>>
>>108178298
This answer for today's was genius haha. Not mine I just used a string like a pleb. I gotta bit shift more.

>693. Binary Number with Alternating Bits
>Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.



>Example 1:
>Input: n = 5
>Output: true
>Explanation: The binary representation of 5 is: 101

    //      10101010101
// + 1010101010 ( number >> 1 )
// ---------------
// = 11111111111
// & 100000000000
// ---------------
// = 0 ( power of two )
let tmp = ( number >> 1 ) + number;
return (tmp & tmp + 1) == 0
>>
>>108183530
VS was just the path of least resistance to get up and running with what I'm supposed to be doing.
>>
>>108183258
If you're a firstie who doesn't already have a job, you're cooked. My employer basically only hires in South America now due to lower wages.
>>
You have hit on a profound realization that usually takes programmers weeks to grasp!
>>
>>108183641
yeah that sounds sustainable
>>
>>108183686
Eh, once they become too expensive there's always Africa.
When cheap labor runs out, all of the people at the top who made these decisions will have already siphoned off generational wealth.
>>
>>108183641
lol you know I actually worked at a similar company. It was kind of hilarious. When I started there was only 1 other guy in the office, so I was like oh cool I guess devs can be remote for this job. But no. The manager spoke spanish so he hired a bunch of programmers in mexico. Their english was okay, but most of the time we had to translate everything through our manager haha.
>>
>>108183784
were they whitexicans or the full on kukulkan worshipping aztec goblin types?
>>
File: 1541435651524.jpg (72 KB, 1200x675)
72 KB
72 KB JPG
>>108159899
Watched this first episode and thought it was going to be kino of the highest order, the 2nd episode was kinda boring, never finished the even more boring ep3, sort of forgot it existed.
>>
>>108183883
what is the anime called?
>>
>>108183947
Golden boy.
>>
>>108183273
>>108183269
aren't they for brown people
>>
>>108184029
take it from someone who lives around wealthy people. they love non brown trade workers and trust them more.
>>
>>108184029
yes lol
>>
>>108184048
take it from somebody that has interacted with rich people, they are all fucking terrible. The more money someone has the bigger piece of shit they are in 99% of cases. I would rather work for someone middle class than a dude with 3 lambos parked in front of their mcmansion. The middle class guy won't backstab me on pay and pester me about the smallest details or throw shit fits when there's miscommunication.
>>
>>108184062
technically youre right
>>
File: IMG_20260219_002418899.jpg (542 KB, 4096x3072)
542 KB
542 KB JPG
today i made a android launcher (right)
>>108160185
honestly so many times im feeling too lazy to use my brain on something slightly complicated so i ask an llm tard wrangle it for 2 hours then end up having to solve it myself anyway
>>
>>108184340
are these actually viable to use daily? I want to use a blackberry but it doesn't seem feasible
>>
>>108184471
the real blackberry on the left not really unless you only want to call/text, one of the right has a replacement mobo with android it seems fine although i only got it yesterday, typing on the keyboard is pretty nice. i dont use my phone much as im at my pc all day so only use mine for clover, discord and a browser occasionally kek.
>>
>>108184524
>replacement mobo with android
oooooohhhh that's really cool anon
>>
File: q25.webm (2.9 MB, 720x1280)
2.9 MB
2.9 MB WEBM
>>108184550
it is super cool i preordered mine back in october last year or something https://zinwa.cn/ specs arent amazing but i dont really care about phone specs kek. camera could deffo be better though
>>
File: 1768522060450777.jpg (45 KB, 680x680)
45 KB
45 KB JPG
>>108184576
>>
File: 1707802844075498.jpg (48 KB, 690x690)
48 KB
48 KB JPG
i got accepted to do a phd at a top univeristy

i can't remember how to code
>>
>>108184889
>i got accepted to do a phd at a top univeristy
so you're unemployed, but fancy?
>>
File: 1709376627719140.jpg (125 KB, 826x871)
125 KB
125 KB JPG
>>108184904
yes
>>
https://www.youtube.com/watch?v=5sZo3SrLrGA&t=2497
>so that's why it doesn't satisfy sequential consistency
illuminating
>>
File: IMG_0014.jpg (90 KB, 1000x676)
90 KB
90 KB JPG
I need Jane to sit on my face RIGHT NOW
>>
whats the best way to start on a large project? the only large project i've done before started as a small idea that expanded over the years. but this time i'd be starting out large instead of small.
>>
>>108185217
Starting as a small idea that expands over the years

>but this time i'd be starting out large instead of small
Why?
>>
>>108185241
why? because it's larger and more complex in scope. its just how it turned out.
>>
>>108185258
The problem is that starting an idea large is very inefficient and prone to overengineering, since you are going to make it based on imagination instead of actual testing

Can't you make a minimal viable project, then grow over time towards the larger and complex idea that you have?
>>
>>108183883
You have more patience than I had with fucking Cowboy Bebop. What a disappointment.

>>108184340
>>108184576
Hey, look, an actual pedophile.
>>
>>108185450
it is the mvp lol
>>
i googled some recommendations for doing a large project so i'll try them out
>>
>>108185478
A compiler can start with just math expressions, an OS just taking care of files, a game just with the player movement
>>
vibe check on my codewagies are the AI clowns taking your jobs yet or just the frontend trash that clutters every website? can AI flash my drone and help me put a tiny vision model on the chip with compiler/assembly optimizations so it can do facial/object recognition in a sub $200 kit or nah? im going through k&r again after not touching code for 2 decades and the free LLMs (gemini, chatgpt) seem to know a lot about ansi c across its various standards.
>>
>>108185753
>ansi c
>>108168165
>>
File: richard.png (1.53 MB, 1366x916)
1.53 MB
1.53 MB PNG
Good morning my ladies. Today will be a good day. Today will be a great day. Today will be one of the greatest days
>>
>>108185873
Time to finish the project and touch grass soon (tm)
>>
File: great.jpg (263 KB, 1742x932)
263 KB
263 KB JPG
was watching different videos about microkernels and eurika! a though came, the future OS (microkernel) should be built with the runtime, all those userspace "services".

ye, initially it will perform slowly, but later may be optimized. contrary, development speed would be much faster. though, the runtime has to be made first.
>>
I just wish the Germans would fuck off already.
>>
>>108186281
>but later may be optimized
No!

No, you fucking retard. It fucking won't.

What is it with you fucking autists not understanding that? Protection rings and microkernels don't fucking mix, and anyone who claims otherwise is fucking delusional.
>>
>>108186292
no problemo nonersama, then, there be no protection rings, CPU will work in that old supermode, like in DOS.

may be kinda switch for gaymers

PRESS Q TO ENTER QUICK MODE IN 5.. 4.. 3..
>>
>>108186397
>there be no protection rings
Yeah, because DOS was sooooo good too.

At this point you're no longer autist and straight up schizo.
>>
>>108161830
It did exactly what you said
>>
>>108186281
Microkernels don't work because the overhead of passing messages between protected services HAS TO be large. If it wasn't they wouldn't be very protected.
Why aren't applications split up into hundreds of tiny processes that all communicate through sockets if it's such a neat idea? Because it's truly insane.
And in the end what have you achieved? Whether a monolithic kernel has a bug or a microkernel has a bug, the end result is your system has a bug and when it's triggered, there's no unfucking the system. So you can restart a submodule? Whoop-de-doo, does that fix the bug? No. Are all the other dependent modules fault tolerant enough to deal with a service going bye-bye? Unlikely. Did your system crash anyway? Very likely. And what about security? Microkernels are awesome because everything is isolated? Horse cocks. Complete horse cocks right up your bum bum. Whether you pass shit around on the stack or through sockets, the end result is a buggy service gets data from a poorly validated source. If you can pwn a kernel with an overflowed buffer, that buffer will more than likely get passed right into the submodule that would have got you pwned completely raw anyway. And once it's compromised, it'll just start using the official interfaces to set up itself however it wants, because if it's in the kernel, it's there for a reason so it's obviously trusted.
Microkernels are a thing for drunk CS professors to wank over, that's all.
>>
File: 1769579349852237.png (9 KB, 480x600)
9 KB
9 KB PNG
>>108163813
No but it will make you into a trooter
>>
>>108186640
ye, nice kinda drunken master babble about microkernels being bad, but you completely ignored my quite specific points and even mish mashed threading model where processes belong.

i didnt even mention sockets and LIBC, guess its all GPL-tards know for IPC.

--
so, my point was mostly about equalizing performance, i forgot how those modes were called, real mode, yes, so nope, no need to switch CPU, just running everything in ring 0 as real-time OS does
>>
>>108186704
>just running everything in ring 0 as real-time OS does
You should've put that in the very beginning, so that every non-schizo could've just skipped the rest of your drivel-ridden post.
>>
>>108186661
what's bad about that?
Or what does the author want to say with the attached picture? To me it gives the post a cynic undertone.
>>
File: goldenboy6.gif (1.71 MB, 330x270)
1.71 MB
1.71 MB GIF
>>108160224
It was the actual conversation.
Come on, you guys haven't watched Golden Boy in your teenage years? Even the dub is good.

>>108163181
She is the CEO. Go watch it.

>>108183883
The episodes are isolated stories.
I don't remember which one is which but some are more boring than others.
When I watched it I thought it was comedy gold, but that was some 25 years ago.
Still have some old ass pictures from that time saved, like picrel.
>>
>>108186905
>Come on, you guys haven't watched Golden Boy in your teenage years? Even the dub is good.
I have never watched any of your cringe. Maybe just some clips here on reddit.
Also maybe some parts of naruto back in the day when it came in television, but then realized it's absolut dogshit and from then on kept only watching pokemon and dragonball on television.
Soon I grew up and since I don't watch children movies anymore
>>
>>108186905
>Come on, you guys haven't watched Golden Boy
Did you miss the part where I mentioned what I remembered about the show?
Come on, you guys don't have reading comprehension since your teenage years?
>>
>>108187138
Sorry anon, my bad.
>>
>>108186976
>kept only watching pokemon and dragonball on television
You shit on "my cringe" and then you invalidate your whole post saying you watch modern Pokemon and Dragon Ball unironically?
I sure hope you don't mean the newer "Dragon Ball" series.
>>
>>108187301
No. whatever was running in the early 2000's. So original DragonBall and DragonBall Z, I think.
What was the one after that? GT or something? I didnt like that
>>
>>108187329
>GT or something? I didnt like that
Good, because GT is filler and shit.
>>
>>108186976
>Soon I grew up and since I don't watch children movies anymore
>>
File: idk.png (18 KB, 681x588)
18 KB
18 KB PNG
>>108159899
Vibe coded a chat app that uses the BitTorrent DHT network. You pick a room name, it gets hashed into a torrent infohash, peers find each other through the DHT infrastructure, then talk directly over TCP, no accounts, no servers, etc. C# + MonoTorrent.
>>
>>108187587
Okay, I am very close to my daily goal, but i have to pee first
>>
Python, Golang, Java or C#/.NET?

(I'm in Russia)
>>
>>108187724
Ada
>>
>>108187748
larpmaxxing
>>
File: ada.jpg (266 KB, 1280x1257)
266 KB
266 KB JPG
>>108187748
>>
>>108187724
Obviously C#.
>>
>>108187724
Rust
>>
>>108187691
the fuck are you talking about?
>>
>>108159899
I have been learning web dev from the odin project and i am like 60 % done. i took JS path. Anyways so i like coding and stuff but is it over for giys like us to get a job by learning this ? i have degree in mechanical engineering but the pay is low in this field. so what should i do ?
>>
>>108187864
cry or make a manufacturing execution system because all the ones in the space suck ass anyway. (good luck I guess)
>>
>>108187874
tf is that ? i am bot MIT grad man damn, i just wanna get a cushy button pushing job so i can relax later.
>>
>>108178408
it isn't because 4chan isn't a le sekrit club anymore
trying to gatekeep content in 2026 is peak newfaggotry
especially in this age where fansubbing is dead and old stuff are beginning to disappear (unless you managed to fellate some tranny freak for long enough for him to allow you into a big private tracker)
>>
>>108187951
I thought you said manufacturing engineer. my bad.
>>
>>108187823
That's no problem for me
>>
>>108187972
>it isn't because 4chan isn't a le sekrit club anymore
That's not a reason not to admit a litmus test.
>>
File: 1753071854663408.png (46 KB, 225x225)
46 KB
46 KB PNG
>interviewing for some generic swe job that pays well
>ask them what languages they want
>python / java / javascript
>>
>>108188207
Sounds like they stay afloat by government contracts.
>>
Symbolic differentiation for fun.

Taking the derivative is the easy part. Simplifying expressions seems like a pain in the ass.
>>
>>108187587
Just use iroh
>>
>>108187587
not programming
>>
I am somewhat new to all this but i wanted to try link(s) related using local qwen3 coder 30b that tool-calls sympy and or numpy.

idea is to vibecode a shitty version of photomath/wolfram alpha that displays solution via LaTeX as a beginner project.

if I can do all that then next step would be to have it try to solve and interpret textbook problems but let sympy handle actual math when possible and using the LLM as a director otherwise so it doesn't hallucinate all the answers.

:

>https://medium.com/@ncaraliceanews/how-to-build-a-symbolic-math-assistant-with-openai-langchain-and-sympy-bd320f19b33b

>https://github.com/caralislabs/ai_foundations/tree/main/langchain_sumpy_openai
>>
>>108188716
this kind of simplification isn't hard
you need to keep applying simplification rules until you can't apply any rule
transform: x^2 => x*x, a * (b/c) => (a * b) / c, etc.. see if that works

you'll probably need to do reassocation
https://stackoverflow.com/questions/23827531/reassociation-according-to-muchnick
>>
>>108189317
>reassociation
Neat. Will have to do some reading, I guess. Dunno how far I will take it, but poking around ASTs is fun.
>>
>>108189715
>poking around ASTs is fun.
Yes it is. If you like this, you may be interested in compilers and optimizing compilers. There are a lot of tranformations like that, although it is not on ASTs but on intermediate representations (SSA, Single Static Assignment) that integrate the control flow graph as well as expression trees, basically.

There are a number of optimziations ("dataflow analysis") like constant propagation, constant folding, dead code elimination, etc.. which together allows you to evaluate at compile time anything that can be computed at compile time. They work a bit like algebraic simplications.
>>
In embedded you can spend many lines to configure pin but usually just driving the pin will work because it will write to the register and the the pin.
It's pretty simple. Other phreripherals might override you but that's chip specific.

Now this is modern python example of setting pin value and the fags actually defend the implementation.
The API sucks and maybe they had a point but it doesn't address any problems, it's just verbose because...?
import gpiod
import time

from gpiod.line import Direction, Value


def toggle_value(value):
if value == Value.INACTIVE:
return Value.ACTIVE
return Value.INACTIVE


def toggle_line_value(chip_path, line_offset):
value_str = {Value.ACTIVE: "Active", Value.INACTIVE: "Inactive"}
value = Value.ACTIVE

with gpiod.request_lines(
chip_path,
consumer="toggle-line-value",
config={
line_offset: gpiod.LineSettings(
direction=Direction.OUTPUT, output_value=value
)
},
) as request:
while True:
print("{}={}".format(line_offset, value_str[value]))
time.sleep(1)
value = toggle_value(value)
request.set_value(line_offset, value)

toggle_line_value("/dev/gpiochip0", 5)

>>
>>108189997
I've played around building some toy interpreters, but never made the leap to compilers, since I don't know much assembly. One of these days I'll get around to it. The optimizations seem really cool.
>>
>>108190340
Can't be worse than what we already got.
>>
>>108190468
I don't know what any of that means. I barely understand C and I've never touched asm.

I like my comfy high level shitlangs. Modern hardware is too big and complicated for my caveman brain.
>>
>>108190496
You're engaging with the resident schizo. You should disregard everything they say and ignore them.
>>
>>108190496
between a lone schizo and a guy with such blurry vision that he speaks of the lone schizo as a "they", you should absolutely side with the schizo.
And the schizo's message is to produce slop and not worry about it, because you're competing with slop actually. This is also an early remark in https://compilers.iecc.com/crenshaw/
>>
>>108184576
okay anon what's not really cool is having pictures of little cartoon girls on your phone. please find Christ and never look or think about that stuff again
>>
>>108190701
he's just helping to raise awareness of Epstein's crimes, with the Snatch Queue
>>
i got app ordering working took me like 4 hours kek
>>
>>108186640
>Microkernels are a thing for drunk CS professors to wank over, that's all.
Some of the better parts have made it outside of that wankfest, such as fuse.
>>
>>108191155
>fuse
Toy.
>>
File: TRUE!.gif (28 KB, 220x221)
28 KB
28 KB GIF
>>108191350
>(You)
faggot
>>
>>108186640
If the microkernel had a good way to bactch system calls and then the subsystem would serve the request concurrently through shared memory without requiring a context switch, it would result in less context switches than for a monolithic kernel *if* the requests are properly batched by the user program.
>>
Please quickly review my PR. This is just for some debugging output. Lets quickly get this in!!

    process(PCLK, PRESETN)
begin
if PRESETN = '0' then
int_count_ff <= (others => '0');
int_count_ff2 <= (others => '0');
int_per_s_ff <= (others => '0');
int_per_s_ff2 <= (others => '0');
elsif rising_edge(PCLK) then
int_count_ff <= std_logic_vector(int_count);
int_count_ff2 <= int_count_ff;

int_per_s_ff <= std_logic_vector(int_per_s);
int_per_s_ff2 <= int_per_s_ff;
end if;
end process;

process(ACLK, ARESETN)
begin
if ARESETN = '0' then
int_count <= (others => '0');
int_per_s <= (others => '0');
prev_int_cnt <= (others => '0');
prev_int <= '0';
elsif rising_edge(ACLK) then
if aclk_cnt = 0 then
aclk_cnt <= to_unsigned(ACLK_HZ-2, aclk_cnt'length);
if unsigned(int_count) > prev_int_cnt then
int_per_s <= (int_count - prev_int_cnt);
else
int_per_s <= (others => '0');
end if;
prev_int_cnt <= int_count;
else
aclk_cnt <= aclk_cnt - 1;
end if;


if prev_int = '0' and VDMA_INT = '1' then
int_count <= int_count + 1;
end if;
prev_int <= VDMA_INT;
end if;
end process;


did I miss something???
>>
>global variables can be initialized with an inline lambda
>thread_local variables can't, because THEY JUST CAN'T OK?

jokelang
>>
>>108191607
>4chins still can't even the most based DoD language
what a disgusting forum. I'll report this to the FBI
>>
>>108191607
>Int/second: 30
Interrupts are literally working perfect.
Fucking linux uio is trolling me this dumb piece of shit (i get about 60 interrupts per second in uio, which makes the websocket transfer too many images and visible video slow af).
Fuck you richard.

At least AI made my web interface look decent now
>>
>>108191515
>it would result in less context switches than for a monolithic kernel
Mate.

What is the point of a microkernel? The one selling point it has over a monolith?

>>>That less code has to run in a privileged execution, meaning less chances the kernel is ever compromised.

And if you introduce proper batching, like with Vulkan-style command buffers or something, then all of a sudden you're talking about complex structures the kernel has to verify and potentially copy from one place to another and then back, and then you need a complex, asynchronous dispatching infrastructure. And that is a fucking mess, at least going off by how NT dispatches messages to windows.

So you end up with code and complexity in the kernel you were originally trying to avoid in the kernel in the first place. In fact, if anything you should be wondering why our *current, modern kernels LARPing as monoliths* still use piecemeal microkernel interfaces, because it's OK for them to be complex.
>answer: because they were designed by incompetent autists who ignored the signs of the present (mode switching costs, pipelining, TCQ) and instead looked to the past: >>108177825
>and because muh backwards compatibility
>>
>>108191964
>What is the point of a microkernel? The one selling point it has over a monolith?
Ease of implementation and better safety through isolation.

>And if you introduce proper batching, like with Vulkan-style command buffers or something, then all of a sudden you're talking about complex structures the kernel has to verify and potentially copy from one place to another and then back
Probably yes, but what you gain is potentially less context switch. If Vulkan chose this architecture it's that it made sense in terms of performance. The video game / video stream is actually something I had in mind and something that would work well for this. Paying a little cost to set things up is well worth it when the program is going to be locked in for many many seconds doing the same data processing task.

>and then you need a complex, asynchronous dispatching infrastructure
>So you end up with code and complexity in the kernel you were originally trying to avoid in the kernel in the first place.
that's a lot better than having many file systems, device drivers and god knows what in the kernel itself
>>
>>108192076
>but what you gain is potentially less context switch
How more fucking obvious do I have to be?
>you should be wondering why our *current, modern kernels LARPing as monoliths* still use piecemeal microkernel interfaces, because it's OK for them to be complex
>you should be wondering why our *current, modern kernels LARPing as monoliths* still use piecemeal microkernel interfaces, because it's OK for them to be complex
>you should be wondering why our *current, modern kernels LARPing as monoliths* still use piecemeal microkernel interfaces, because it's OK for them to be complex

IT'S THE MONOLITHS THAT ARE SUPPOSED TO HAVE LESS MODE SWITCHES (not context switches, different thing)!
>>
>>108192089
>>but what you gain is potentially less context switch
>How more fucking obvious do I have to be?
The main issue with microkernel is the overhead due to too many context switches and batching could very well be a way around that. So what's the problem now?

>you should be wondering why our *current, modern kernels LARPing as monoliths* still use piecemeal microkernel interfaces, because it's OK for them to be complex
I don't know which interfaces you are talking about but to me, without furhter information, it seems like they try to keep the kernel modular, which is a good software practice.

>IT'S THE MONOLITHS THAT ARE SUPPOSED TO HAVE LESS MODE SWITCHES (not context switches, different thing)!
jesus christ, can't you fucking NAME wtf directly wtf you are talking about instead of being permanently evasive?
>>
>>108191607
What language is this?
>>
>>108192234
>So what's the problem now?
Read the fucking post again:

>>108191964
>That less code has to run in a privileged execution, meaning less chances the kernel is ever compromised.
>So you end up with code and complexity in the kernel you were originally trying to avoid in the kernel in the first place.

The moment you make a microkernel more complex it yields its main advantage, and at that point you're just making a weird hybrid that would have been better off being completely monolithic - see NT and its services for plenty of examples.

>I don't know which interfaces you are talking about
>>108182357
Or what, you want some non-file related? Alright:
>madvise
>mmap
>epoll_ctl
>accept (which was so retarded they made another version, accept4, which is less retarded because it saves one call to fcntl to set sockets to non-blocking, but on the other hand more retarded because the devs "forgot" that people might want to collect *multiple incoming connections in one switch*) - oh, yes, speaking of which:
>fcntl

Or, and I know you fucking autists hate that idea: >>108172221

>which is a good software practice
Flew out the window with the introduction of mode switches in 1982. The UNIX philosophy is outdated, and you're refusing to admit it.

>instead of being permanently evasive
How about: I found another autist who belongs in a cage? Is that direct enough for you?
>>
>>108192309
>How about: I found another autist who belongs in a cage? Is that direct enough for you?
Is this some sort of fetish of yours
>>
>>108192326
It reinforces the notion that autists are animals who should've never been given human rights because their brains are structured differently - and anti-empathically - from normal human beings.
>>
>>108192367
Newton was most definitely autistic.
>>
>>108192400
And he was smart enough not to make lasting infrastructure. Can't say that for most fuckups out there.
>>
>>108183883
You should have watched episode four, with the swim instructor.
>>
File: carbon.png (176 KB, 2000x1462)
176 KB
176 KB PNG
If let chains + pattern matching is so cool.
Macros are too.
>>
>>108192614
cool, and much more of a chore to maintain. If you need slightly different behavior later you may have completely rewrite these 27 lines. If you only suspect that you may need different behavior, you have to track control flow through this thing, and have to consider all of the other match results. ML-style pattern matching is normally a huge bonus to maintainability, simply from forcing you to enumerate cases, and Rust inherits that advantage only to throw it away.
but maintenance pain is a constant with Rust.
>>
>>108192678
>If you need slightly different behavior later you may have completely rewrite these 27 lines.
Not really. The only difference between this and version without let chains would be egyptian style nested ifs.

>simply from forcing you to enumerate cases
Why would I do that in a macro though? I do not need to handle or care for all theoretically possible AST shapes. It's just a small macro that generates a thin wrapper around a function and does some special behaviour depending on return type.
>>
>>108192909
no, without the let-if syntax you would try harder for a different design. And the provider of the API would try harder to give you something good to use. What let-ifs do is allow you to settle on a bad way to do things, but express it cleanly enough that you figure it's more trouble to do better.
What you do here with "egyptian style nested ifs" is like if you had C preprocessor macros all through your code and defended that by pointing out that literally copying-and-pasting code is much worse. "If I didn't have C macros then I would be using vim macros to generate code, and that's worse!" Yeah, I bet it is. But you're only even thinking about that bad code because your code desugars to it. I sure didn't bring it up.
>>
>>108193079
>no, without the let-if syntax you would try harder for a different design
I am talking about let if chains, not just regular let-if.

>And the provider of the API would try harder to give you something good to use.
What's the point if pattern matching would be more flexible anyway?

>What let-ifs do is allow you to settle on a bad way to do things
I find pattern matching to be extremely useful and improves code readability significantly.

>What you do here with "egyptian style nested ifs" is like if you had C preprocessor macros all through your code and defended that by pointing out that literally copying-and-pasting code is much worse. "If I didn't have C macros then I would be using vim macros to generate code, and that's worse!" Yeah, I bet it is. But you're only even thinking about that bad code because your code desugars to it. I sure didn't bring it up.
I don't really get this analogy. if let chains are just syntactic sugar for nested ifs, that's literally all there is to them.
Maybe just rewrite that code in whatever syntax you think would be more suitable to solve this particular problem.
The code should be self explanatory. It just initialises these few values like write_stack, ret_try, ret_value based on the function's return type. You can ignore quote! {...} macros and threat them as just strings.
Here is some of the AST types:
https://docs.rs/syn/latest/syn/enum.ReturnType.html
https://docs.rs/syn/latest/syn/enum.Type.html
https://docs.rs/syn/latest/syn/struct.Path.html
https://docs.rs/syn/latest/syn/struct.Ident.html
https://docs.rs/syn/latest/syn/enum.GenericArgument.html
>>
>>108193250
>What's the point if [let if] would be more flexible anyway?
is Rust your first programming language, man?
GOTO is more flexible than structured programming. A function call is less flexible than pasting the body of the function into your code. The benefits come to code in motion, over time, under maintenance, when you come back later and want to make a specific adjustment without introducing lots of new errors because you no longer remember even writing this code, or didn't write it.
That's what I said at the outset. What you're doing is indeed cool, but it sucks for maintenance, and since Rust sucks in general for maintenance, that's really to be expected. You're going to all this work to defend your code but you're going to be the one having to maintain it, not me.
>>
>>108193336
>is Rust your first programming language, man?
No, but I don't think I've done strongly typed procedural macros in any other language.

>GOTO is more flexible than structured programming.
>A function call is less flexible than pasting the body of the function into your code.
Flexible? Maybe, but much harder to express the intent.

>The benefits come to code in motion, over time, under maintenance, when you come back later and want to make a specific adjustment without introducing lots of new errors because you no longer remember even writing this code, or didn't write it.
So, what would this code look like in an alternative syntax that does not have this issue?

>What you're doing is indeed cool, but it sucks for maintenance, and since Rust sucks in general for maintenance, that's really to be expected.
I have been working on this project for several months now and didn't had any issues with maintenance. What kind of problems are you talking about?
>>
>>108169322
<print> if you don't care about your compile times, or just use what the system gives you.

An unrelated gripe with the STL: If I want to debug C++ with GDB, am I supposed to write my own pretty printers for every single fucking variation of compiler version, compiler and container I use? Insanity.
>>
>>108187264
It's all right, /g/. I was a wee drunk and a little aggressive, so my bad as well.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.