What are you working on, /g/?
Previous thread:
>>105515327
>>105527765>All code is singlethreaded.Oooh, a swing and a miss. At least in general.
Realtime code sees your assertion and chuckles mirthlessly. Things are more complicated than you think.
bringing graphemes to readline
>>105530187what's the point?
>>105530211perfect grapheme handling. readline has trouble with zwj sequences. my library adapts based on how your terminal internally handles grapheme clusters. Under two terminals different sequences will render differently, so this lets me support all rendering.
it would be way easier in a program that manages the entire terminal screen (raw mode all the way like vim or nano), but readline has to handle running in canonical echo mode then back to raw mode which makes things way more complex. also this code doesn't use any library, the clustering uses heuristics.
>>105530141this will be another good thread with insightful discussions about programming
i wish /prog/ was still a thing
>>105530141Needing unsafe crates doesn't mean it doesn't have hugepage support
https://youtu.be/rTo2u13lVcQ?si=teJZ_pG9MB1tmAGd
You should at least adjust that particular point
Let's say hypothetically I wanted users to financially support me.
Do I set up a Pateron or a Ko-Fi?
>>105531076Ko-Fi or Buymeacoffee
Patreon takes a bigger cut, and is more averse to wrong thinkers
>>105530990It's not just the initial allocation part though - how do you *use* them? What about dropping, dereffing, and so forth? Doesn't it just end up being a worse version than the equivalent C code?
>>105531134Yes, you need 'unsafe' to use them. But that does not imply that you *can't* do that in Rust. We are not talking about a language that straight up rejects any way of doing that in its functionality
>>105531219Alright, fine.
>>105531239>made mmap schizo edit his imageThat's a victory if I've seen one
this day has been greatly improved
>>105531248>he's never seen the first file mapping primer
>>105531685Step 1: asking yourself what a HAL does.
Step 2: asking yourself how a HAL helps you in whatever you want to achieve.
what are some kewl projects I can make in python?
>t. nublet
>>105531801>kewl>pythonChoose one.
Is vim really worth learning? Is there a good reason to go from vscode to neovim?
>>105531998There's no reason. Try out the vim plugin for vscode if you want to really try it.
Gonna try making an emulator. Should I:
>make a Gameboy emulator
>make a GBA emulator
>make a DS emulator
>make a PS1 emulator
>make an 80x86 emulator
>>105532023Why bother? You cannot faithfully create the memory layout of any system on either Windows or Linux because their shitcode doesn't like NULL.
>>105532023how about an Atari 2600/5200 emulator?
i don't know what to code
some of my personal projects:
BMP to ASCII image converter
rudimentary raycaster using raylib
rendering a 3d spinning cube using sdl3
was making a chip 8 interpreter but lost interest.
was working on a tic tac toe game that supports mp via sockets but i also lost interest (making the game itself is ezpz, now the networking part is kinda "hard").
any fun recommendations that would level up my skills and teach me important concepts?
Done these in C except the raycaster (used c++)
>>105532109Syscall tracer.
Is a monoid im the category of endofunctors in the field of sublinear optical programming?
>>105531998There's no reason to switch other than preferring keyboard navigation and maybe using other tools that use vim style keybinds. Personally I find it comfortable but your mileage may vary.
>>105532109>rendering a 3d spinning cube using sdl3next step is importing an obj file
then after that importing a skinned mesh from a gltf file
>>105532109a boxing/packing program where you give it some objects with their 3D dimensions and it'll try to calculate what boxes (or other arbitrary volumetric containers) and how many of them you would need to fit all the stuff in
oh, and visualize the objects and the boxes they're in, in 3D
>>105530074 (OP)did vibe coding and gemini free + tkinter fucking works
>>105531685Here's how you create a HAL.
1. Create a physics simulation environment. You could theoretically do this in Unity.
2. Create a scaled version of our solar system. Include algorithmic placement of asteroids and such. Be sure larger planetary objects have simulated gravitational pull, light emission from the sun is accurate and casts shadows, and try to make the orbits semi-accurate.
3. Now that you have a programmatic simulation environment of space, it is time to construct a virtualized space vessel. You will need to meticulously ensure all mechanical and electrical systems can be partially or wholly integrated with an API external to the simulation environment. This means the Api should provide full remote control of the ship, such as the ability to navigate the thrusters, adjust power levels, read sensor data, ect. It cannot be understated how important fully integrating every little aspect of the ship into an API is. Hell, there should be a cockpit even with a 'camera' that cac have its current view accessed via a GET and displayed as an image.
4. Now that you have painstakingly created a space physics simulator with a scaled down version of our solar system, and a space vessel with every sensor and electromechanical feature integrated into the Api, you must now begin a very long journey of training a multi-modal agent to operate the vessel. You will have to integrate all the Api data feeds into it and give it proper training and directive. This could take a while. Ideally you would give it a higher level prompt, run multiple parallel instances, then manually rate the trials and use the results as training data.
Good luck!
>>105532885>vibe codinghobby board
post it on hackernews where people might care
i don't want to be the bajillionth guy asking about vim but is it really worth it to learn it? does coding faster really matter?
>>105530074 (OP)So it's my understanding that returning pointers to local variables in C is UB. However when using Vulkan I've encountered this pattern:
VkShaderModule create_shader(
VkDevice device,
const std::vector<char>& shader_code)
{
VkShaderModuleCreateInfo create_info {};
create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
create_info.codeSize = shader_code.size();
create_info.pCode = static_cast<const uint32_t*>(
static_cast<const void*>(shader_code.data()));
VkShaderModule shader_module {};
auto rv = vkCreateShaderModule(device,
&create_info,
nullptr,
&shader_module);
if (rv != VK_SUCCESS)
{
throw std::runtime_error("Failed to create shader module");
}
return shader_module;
}
Where VkShaderModule is a typedef struct VkShaderModule_T* VkShaderModule;
Why exactly does this work? Is it because the memory for VkShaderModule lives somewhere else? I'm not clear on this.
>>105533795there's nothing to really learn if you're using it on a basic level. is it "worth it" probably not if youre never going to ssh / work on servers.
>>105533809It works because vkCreateShaderModule returns a VkShaderModule a.k.a. a VkShaderModule_T*. It's the address to a structure that (most likely) points to the heap.
>>105533795You won't know till you try.
>>105533809Also
>std::vector<char>& shader_codeImagine storing a copy of your shader code in a vector when you could be using a file mapping instead.
>>105533809It's only UB when returned to something outside of it's stack scope, ie a function. This is a handle to something somewhere else in memory outside of your program.
>>105533809it's not a local pointer it's a typedef of a pointer to an opaque struct which is the typical and easy way of doing a handle
the point is you don't and can't know where the memory for it is, and because of layers you can't even necessarily control or predict that either since layers can dynamically dispatch of object handles]
i've done it before but strictly speaking even if you know what you're doing and are drilling down into the real object structure from the underlying driver i don't think it's necessarily safe
>>105533882and by safe i mean safe according to vulkan
i don't think there's any guarantees that the current loader behavior is stable or that the current behavior will even ever actually give you a real object handle at some point
>/dpt/ can explain why the local pointer to heap memory can be safely returned
>/dpt/ can't explain how to make a HAL
>>105533809It returns the pointer by copy, simply copying the address. Address is somewhere on the heap, allocated by vkCreateShaderModule.
>>105533809int* ub()
{
int a;
int *ap = &a;
return ap;
}
int* not_ub()
{
int *ap = new int;
return ap;
}
>>105532023Why not work on a "piss easy" system like the ZX Spectrum and give it a niche feature not many over emulators have like:
>lua scripting and texture pack support (Mesen)>transistor-level accuracy (MetalNES)>static recompilation support (surprised nobody has tried this for an older system, wouldn't be too hard to get an entire system library running natively)
>>105534459>luaSo has their memory management gotten ANY better? Because last time I checked "clusterfuck" would be selling it short.
>>105533795it takes like 1-2 days to get familiar with it, just try it
file
md5: eff362fda8a7c06c1173aef29eda339e
๐
why is this code passing in a double pointer to allocate on instead of just a single pointer?
>>105534880Learn the fucking language or stop doing whatever it is you're doing. Your call.
>>105534880the parameter is also the return value
>>105534880>why is this code passing in a double pointer to allocate onBecause that code is shit.
If I publish an app, is my shit visible to people? Name, email etc
>>105535774yes, play store is pretty strict with their review process.
Not sure about f-droid.
You can also just distribute the .apk yourself.
>>105535774define publish and define app
app as in application or app as in mobileshit?
publish as in upload publicly or publish as in distribute through a third party vendor's store?
last i looked into it the google play store basically requires you either set up a corporation or dox yourself now and i don't think you can just use a PO box anymore either
i believe that info is public
though alternative app stores and package repositories are a thing on android a fair amount are FOSS/freeware oriented
not sure if apple is any better, doubt it
i don't think steam, gog, or epic require that though so i think game distribution is safe
microsoft authenticode certificates for making signed binaries for windows (and thus for things like publishing actually installable appx packages from the windows store) are costly and i think you do have to provide docs to CAs that issue them
i do not know if you can get ask for them without embedded personal info or at least with embedded personal info not linked to a real world identity
>>105535881mobile shit on google and ios
>>105535850>>105535881Well it's natural if Google/Apple knows who I am, but I mean if that info ends up being visible to other people. Users and what not.
>>105535932by dox yourself i didn't just mean to google, google publishes it in the app's store page and they don't let you use a PO box anymore, which you used to be able to
this is VLC for android's app page, all that is required
if google does something developer unfriendly the safest assumption is always assume apple is 100% worse but i don't actually know
it's really not worth caring about anything apple as a platform as a small/independent developer
>>105536040wtf this is fucking grim
why is this even necessary
>>105536053What's the alternative? Some Russian or Chinese provider? Lmao.
Three and a half more hours spent burning brain cells in SICP today. Today's section was on time/space complexity and a lot of really dull theta(n) analysis. I've always just handwaved this stuff away, so it's probably (maybe?) good that I've got a better handle on it now. At the very least, I understand better how an idealized machine handles deferred calls with respect to pushing/reusing stack frames. None of this stuff is intuitively all that difficult to grasp since it's pretty obvious when a process is going to blow up or not, but hopefully the ability to more formally reason with more granular differences (e.g. O(log n) versus O(n)) will be helpful as I continue on the journey.
Thanks for reading my blogpost
First time programming in half a year. Making a link aggregator in PHP and Postgres, no JavaScript planned yet. Took two hours just to study PostgreSQL documentation to come up with three table layouts. I'm hella washed up.
>>105536084christ
does adsense dox you too?
Hmmm today I will write some Rust
nig
md5: ed7962c2f1ddefc6ea758a0615ce254f
๐
that's it. this is what I am up to. the retardation.
on bottom the good ol implementation, which sucks, cuz it uses static arrays, which makes this shit stack allocated, it could be wrapped inside box, but still the stack can be fucked up if size is too big.
on top is nu implementation, which now allows to use dynamic arrays (vec), but shit looks horrendous, I am too retarded to do it right.
I've also came up with a new idea: using slices, which will imply that lifetimes are stored somewhere and all shit is just representation, but then it kinda breaks the whole point of static operation checking, even though it will be the same shit as vec rn, which still uses const type parameters but they can be left out, as they are not inferred as with arrays
>>105538875in Haksell this is just sequence
>>105538504Leaked pic of anon later today
>>105538875also names are kinda random the builder is not the builder pattern or whatever just shit that returns matrix.
allocator trait is not really an allocator just shit that provides some kind of memory representation so an array (static | dynamic)
and types A and B don't actually need IndexMut trait bound just Index, but cuz it's not the only trait, I just copy-paste where clause
>>105538875Will you admit defeat and come back to C?
Or will you resist, learn nothing, and write angry posts on a Mongolian basket-weaving forum?
>>105539049wut? there is no way to do shit like this in C, the whole idea is to check operations at compile time, so for example matrix multiplication is checked at compile time since the output type is MxK and left matrix is MxN and the right matrix is NxK there is no runtime check and all other matrix dimensions should fail at compile time.
>>105539219does rust have HKTs and HRTs (no not that kind of HRT) if so you could implement traversable
>>105538919
>>105539219>the whole idea is to check operations at compile timeYeah, sounds useless.
>>105539287Why would he go back to C instead of just not doing it? That's like telling someone who lives in the US and doesn't like burgers that he should go live in Africa instead of just eating something else. Kek
>Android Studio system requirements
>32 GB RAM recommended
>GPU with 8GB VRAM recommended
Fucking bastards
>>105538964Indeed it kind of fucking sucks. But I'm kind of getting the hang of it.
>>105538952Python is a shit language for niggers, you should learn literally anything else, I guess Go is an ok starter language, or Rust if you're trans. Anyway, as a beginner project you can do something like drawing some kind of pattern or image on the terminal or in a bitmap image.
>>105530898I wasn't there, how was it different?
>>105531801Idk, do CLI stuff.
(I'm assuming you're a beginner here).
Connect to a database and retrieve/push values for starters. Start stretching those programming muscles first
Practicing some recursion and then I may do a hello world with sneed7
>"Please consult our API documentation to learn how to use this library."
>alphabetical listing of 5000 functions and types
>all descriptions are 1 sentence max
AAAHHHHHHHHHHHHHH
>>105541787Typical pajeet project.
Just don't waste your life on it.
My personal project's API now requires a lot of w*bshit and it's pure suffering.
>>105541787It's self-documenting
>>105541350#include <stdio.h>
void rec(char** s)
{
if (!**s)
return;
putchar(*(*s)++ - 1);
rec(s);
}
int main(int argc, char** argv)
{
char* msg = "gbhhpu";
rec(&msg);
return 0;
}
>>105542022Christ.
#include <stdio.h>
void rec(char* s)
{
if (!*s)
return;
putchar(*s - 1);
rec(++s);
}
int main(void)
{
char* msg = "gbhhpu";
rec(msg);
return 0;
}
Dereferencing ain't cheap.
>>105538952Make a Discord bot
>>105542085why are you clowns accessing the byte before the start of the buffer?
>>105542173they're not, it's (*x) - 1 not *(x - 1), its like a cipher
>>105542173>what is operator precedence for 1000
>>105542085>autismImagine if you could use your brain normally
>>105542483Why are you talking about things you've never done?
>>105536053>why is this even necessaryBecause lying asshats otherwise shit the place up. To keep a lid on that, the big app stores require the software to be signed with real identities. Mostly people use corporate identities because it's convenient to keep the money side separate from personal accounts.
If you're not going through an app store, you don't need to follow any of those rules.
>>105536084jannies vetting and packaging everything like god intended.
>>105535522the worst part is it's c++, not c
So how far are you with your registry dumpers?
>>105530074 (OP)Is it true modern compilers compile steganographic or encrypted EXIF data into your programs that you make? Ones that intelligence communities can trace back to your computer's unique MAC address?
Has anyone ever made a desktop environment with nurses?
What would be the implication?
>>105545055You mean this?
https://github.com/RichHeaderResearch/RichPE
>>105545087Undefined behavior.
>>105545055no
they do embed a history of the binutils used on them, which i think gcc usually strips out, which has been used exactly once to track down a malware dev who used odd combinations of versions of legacy and modern tools, on account of being a dumbfuck retrocoder, in both malware and software that was associated with his public identity, and that's it
that is such a retarded schizo view of how surveillance works lmao
and all shit can spoof mac addresses these days anyway, mobile devices even do it by default
>>105545087Utterly Based.
>>105530074 (OP)Lately, I've been wanting to model my programs as a pure data pipeline
Instead of the following syntax, which looks dead simple (albeit ugly, and the reverse to how one would expect the data pipeline to be read):
result = c(b(a(argument)));
I've been thinking of using a function which executes the arguments in it to make the program syntactically tacit, sort of like so. Note: all function signatures are the same:
execute_fns(&result, &argument, a, b, c);
Now, can the compiler see my intent to represent the programs as merely a series of transformations (and optimize accordingly), or is there something about variadic arguments that prevents any optimization?
>>105545515Function calls that exceed the amount of registers the ABI allocates for parameters (4 on Windows, 6 on Linux): bad, because the parameters end up on the stack.
Variadic argument lists: bad, because the spillover parameters will end up on the stack.
Providing function pointers: bad, because the compiler is much less likely to inline the functions (especially across translation units) to improve out-of-order execution. Also compilers are terrible at estimating call depths and will rather generate a CALL/RET pair than a LEA return + JMP target + JMP return combination even though that would improve out-of-order execution (because CALL/RET use the SP register implicitly) without increasing code size.
Oh, and compilers also suck at retaining values in registers. When the ABI says "volatile" they really do mean "volatile", even if the register could act as return value.
>>105545515just overload operator<< bro
>>105545585In contrast using a
c(b(a(argument)))
is relatively straightforward, even if the compiler ends up not inlining the thing. After every call the compiler can just rename the return to the first parameter register:
CALL a
MOV rcx,rax
CALL b
MOV rcx,rax
CALL c
>>105545585This sucks. I expected modern compilers to not be limited by such restrictions.
Anyway, time to present my next terrible idea: dropping down to assembly to use direct threaded code, as presented by Jonesforth.
TLDR: If my program can be represented as a flat array of calls to functions, the opcode to call a function (0xE8, iirc) can be omitted and replaced by the following two lines, provided that esi is pointing to the first member of the function pointer array itself:
lodsl
jmp *(%eax)
For an elaboration, see https://github.com/AlexandreAbreu/jonesforth/blob/master/jonesforth.S#L227
>c99
>_Bool
why the fuck does this stupid shit exist. do boomers really.
Anons, I need to make a fillable form that can be put on a self-hosted website. I have very little time to do this, about 9 hours and I need to sleep during that. My only coding experience is from khan academy JS exercises. This tutorial here seems to cover everything that I need: https://www.youtube.com/watch?v=fNcJuPIZ2WE
But I'm on Linux Mint, and I don't know if I can download Visual Studio and get it set up on time. What programming tool/environment should I use?
>>105545795I'm assuming this is a class assignment? No one with a brain would put someone with no experience in charge of user input.
Just use Kate or Sublime Text or something. They have guis and already have syntax highlighting.
>>105533962>/dpt/ can't explain how to make a HALNow hold the fuck on
Tell me why
>>105533623 was somehow not a valid explanation of how to make a HAL
You could literally train a multi modal agent to operate space vessel I/O
If serious money was put into this, as in an excellent simulation environment and thorough training data, you might actually end up with a model literal space agencies would take interest in for long term deep exploration missions or other planetary ventures
>>105545889Hardware Abstraction Layer, anon, not whatever you've cooked up...
>>105545905I rest my case then.
>>105531685structs and function pointers
>>105542886>Because lying asshats otherwise shit the place up. In other words, it's because of indians. Again.
>If you're not going through an app store, you don't need to follow any of those rules.If I'm not going through an app store, I won't make a dime.
>>105545760>I expected modern compilers to not be limited by such restrictions.Modern compilers become virtually blind once you remove inlining. Fuck, they can't even do partial inlining; see https://en.wikipedia.org/wiki/Loop-invariant_code_motion
>provided that esi is pointing to the first member of the function pointer arrayYou're confusing CALL and JMP. CALL pushes the instruction pointer to the stack for RET to retrieve and then jumps to the target, JMP jumps directly without leaving any return information on the stack.
But hey, maybe you're luckily and the CPU will prefetch the addresses into internal registers early enough that L1 latency doesn't occur.
>>105545846Nope, for a voluntary organization. I'll check those out, thanks anon.
>>105545795Have you considered giving up? You're clearly not up to the task. Sometimes all one can aspire to in life is shoveling shit.
>>105546114I misread the code, my bad.
Anyways, one implication of replacing the typical CALL/RET pair with only appending LODSBs and JMPs that interests me is that I'm well on my way to getting myself an indirectly threaded forth interpreter.
Now, given the concatenative nature of forth code, I could recursively inline the definitions of the forth functions into one giant program (stripping away unneeded instructions such as paired pushes, pops, etc).
Now, is there any perfomance downside to running 100% inlined code, with no jumps or calls at all whatsoever?
>>105546260>running 100% inlined codeSyscalls cannot be inlined. They run in an entirely different mode.
>no jumps or calls And how do you handle failure? Especially if the failure comes from the kernel? If a file couldn't be opened or memory couldn't be allocated?
And let's assume you're doing nothing but userspace operations - even then you are going to experience slowdowns because the instruction cache would essentially turn into a ring buffer, and the prefetcher could only prefetch so much before bus latency itself becomes a problem. Same with the iTLB by the way, only that the prefetcher might not even prefetch these ahead of time.
>>105545585C++ seems to output something okay
https://godbolt.org/z/MsEbGTozc
Since im new to django i asked ai to tell me how to populate a field thats a foreign key with an object instead of an id( pretty basic thing in web dev) and even after repeated prompts it couldnt do it. At the end i did it manually with the help of SO
Nice ai hype bubble you got there
pair programming in emacs with AI
https://github.com/MatthewZMD/aidermacs
>>105547300Seems to be working as intended.
>>105547519Have all these people using emacs been using it for 20+ years? There's no way it's worth getting into now.
>replace recursive variadic template functions by a struct and std::initializer_list
>code is easier to use and more organized
>but I don't get to feel smart when I look at it
Not sure if it was worth it
>>105545889>If serious money was put into this, as in an excellent simulation environment and thorough training data, you might actually end up with a model literal space agencies would take interest in for long term deep exploration missions or other planetary venturesYes anon, the same people that forbid heap allocations will put a probabilistic next word predictor to pilot their 50 billion dollar misison.
>>105549251The key points here
>long term deep exploration missions>other planetary venturesGive me a better solution to the problem of not being able to have crews on deep space missions then.
>cryogenics and deep sleep is a fairytale and will almost always result in a dead human>attempting to sustain a multi-generational crew with a micro colony will almost certainly lead to a Lord of the Flies esque situation but much more grimMake a concrete argument as to why a multimodal AI agent trained specifically for vessel operation in deep space is a bad idea and not possibly a multi billion dollar idea.
>>105534459Static recompilation of an old console where cycle accuracy requires running each subsystem for only 1 cycle wouldn't be too hard? If you know how to remove the scheduler overhead and linearize the executed code of the multiple systems running in parallel while maintaining cycle accuracy, I'd be glad to hear it.
>>105549322>will almost always result in a dead humanGood.
>>105549322>>105549322>The key points here>>long term deep exploration missions>>other planetary venturesI can't be bothered to reformulate, it's clear enough and you should easily understand my objection. If it's for safe guarding humans it's even worse.
>cryogenics and deep sleep is a fairytale and will almost always result in a dead humanCryogenics works on egg cells, although with a significant failure rate, so it's not complete science fiction, I want to believe that it could work on an entire organism. It's an enginering problem.
>Make a concrete argument as to why a multimodal AI agent trained specifically for vessel operation in deep space is a bad ideaprobabilistic next word predictor. I know it's more complex than that but there remains the fact that AI does not do precise logical reasoning, so it's unreliable.
>>105545585>Also compilers are terrible at estimating call depths and will rather generate a CALL/RET pair than a LEA return + JMP target + JMP return combination even though that would improve out-of-order execution (because CALL/RET use the SP register implicitly)You mean like
f:
jmp rax
start:
lea rax, [rip + 2]
jmp f
would be better than
f:
ret
start:
call f
for out of order execution?
>>105530074 (OP)What do you think of en_US ANSI as kb layout? I am going out of my way to order a laptop with that layout even though I am not a native speaker but I think the it's just more comfortable for coding compared to my localized ISO layout. Opinions? Personal experience with the american layout (no international pls)
Do you guys unironically do test-drive-development (TDD)? I don't understand how TDD is even possible because when you're adding a new feature to an existing codebase, the existing tests won't cover the new feature you're modifying the testable code for.
Do you guys just do TAD - testing-after-development to isolate the code you just added/changed?
>>105550350https://en.wikipedia.org/wiki/Continuation-passing_style
instead of doing a call/return, you pass a continuation to the called procedure. that procedure can then pass that continuation to another procedure if needed.
call foo(args...) become goto foo(args..., continuation)
then foo() will either do goto continuation; or pass it to another procedure
>>105550383I've used the ansi layout for years, ~, |, and " are in better positions t. bong
>>105550445What's the equivalent assembly using lea/jmp if you don't mind writing it?
If you're not using FastAPI you're literally ngmi**
``
```python
@router.post("/videos/transcode", status_code=202)
async def submit_transcoding_job(
# Dependencies are just function args, clean as fuck
current_user: User = Depends(get_current_active_user),
db: Session = Depends(get_db),
tasks: BackgroundTasks,
s3: S3Client = Depends(get_s3_client),
# Handles multipart/form-data with file and form fields automatically
video_file: UploadFile = File(...),
options_json: str = Form(..., description="JSON string of transcoding options"),
webhook_url: Optional[str] = Form(None)
):
"""
Accepts a video file and kicks off a background transcoding job.
Responds immediately with a job ID.
"""
# Just works. No bullshit request parsing.
if not video_file.content_type.startswith("video/"):
raise HTTPException(status_code=400, detail="Not a valid video file.")
# Validate the JSON config string using Pydantic on the fly
try:
options = TranscodeOptions.parse_raw(options_json)
except ValidationError as e:
raise HTTPException(status_code=422, detail=e.errors())
# Business logic is clean and readable
temp_path = await save_upload_file_tmp(video_file)
job = crud.jobs.create(
db, user_id=current_user.id, options=options.dict(), webhook_url=webhook_url
)
# The actual heavy work runs in the background. API returns instantly.
tasks.add_task(run_ffmpeg_transcode, job_id=job.id, source_path=temp_path, s3_client=s3)
return {"job_id": job.id, "status": "queued"}
```
``
>>105546940Yeah, I can't get the same output in C if I tried. Could be that I use inband signalling with NULL to determine when the list is at its end, or maybe C++ is even more aggressive when it comes to inlining: https://godbolt.org/z/ssPMq6KqE
>>105550350The CPU maintains a return stack buffer (RSB) for the purpose of predicting where to fetch instructions from. A RET will still cause a sync due to SP dependency, but the CPU will be able to prefetch the target address.
Code that doesn't use RET doesn't have the dependency, and as such doesn't have to sync - but LEA/JMP is only worth it if it's a leaf function that doesn't call into anything else (CALL/RET are much more optimized for stack operations). Also the CPU is solely dependent on out-of-order execution to determine where the return will happen to, so you want to have some instructions between the beginning and the end to give the CPU enough time to realize that the register holding the return address doesn't change and can prefetch instructions accordingly.
>>105530074 (OP)Visual Studio / C# question.
I understand how to make filescoped namespaces default for new classes and projects within an existing solution. Is there anyway to make it default for new solutions as a setting within VS2022 or do I just have to make a template where that is the default?
>>105550495i don't know. you could have a calling convention where the continuation address is passed in the register R13.
mov r13, 0x1234 ; where it should go after foo
jmp foo ; go to foo routine
0x1234:
...
foo:
... ; do stuff
jmp bar
bar:
... ; do more stuff
jmp poo
poo:
... ; more stuff
jmp r13 ; jump to continuation
this way, poo would return way back to 0x1234, bypassing the chain of call/return.
>>105550495CALLEE:
NOP ; Code
NOP ; Cooooooooode
JMP rax ; As long as RAX hasn't been clobbered you're good
CALLER:
LEA rax,[rip + CALLEE_RETURN_1]
JMP CALLEE
CALLEE_RETURN_1:
NOP ; Moooooore coooooooode
LEA rax,[rip + CALLEE_RETURN_2]
JMP CALLEE
CALLEE_RETURN_2:
NOP ; Coooooooooooooooooooooooooode
As
>>105550743 pointed out this requires a degree of coordination between caller and callee that's usually being taken care of by the ABI. Instead of RAX you can use RCX, RDX, or whatever other registers are out there; as long as the callee preserves the register it can return to your caller.
>>105550743NTA but worth mentioning you can even have multiple return continuations to choose from like exceptions
>>105550708>>105550743>>105550822Thanks anons. I'm not familiar with x86 but it's kinda like the link register on arm, I'll try using it when the callee is a leaf
>>105530074 (OP)Why do people use functions to organize code when it can introduce non-trivial overhead?
>>105551714Because it reduces overhead in all cases assuming you have a compiler.
>>105550422I don't test my code, I simply use it, if it didn't work, it would piss me off and I'd fix it.
>>105552179So starting a new stack frame, popping all the passed values onto it and copying all returned values onto the calling stack frame is more efficient than just doing the work inline?
>>105552244If your function actually needs such setup, yes, it's objectively always better.
>>105552261So why is the game I made in C++ around 10% faster when I just copy and paste all the contents of the functions I call, inline into the hot loop?
>>105552322Because you're too retarded to do a pgo build or just manually mark the function to be always inline. Chances are that 10% doesn't mean anything since your "game" is just a cube rotating in empty soulless void like every 4chan project ever.
>>105552372Ok so you don't know or you bullshitting. Got it.
>>105552419Yes I'm sorry for not knowing how to explain to a retarded nigger that marking one function as always inline is trivial but wading through 100kloc spaghetti in one file is not.
>>105550422I test my code after I get something testable, notice the issues and refactor based on that. TDD comes with it's own overhead and you might end up with a headache if you decide to make radical changes, basically rewriting the entire suite.
>I don't understand how TDD is even possible because when you're adding a new feature to an existing codebase, the existing tests won't cover the new feature you're modifying the testable code for.You gotta add (and maintain) the code so yeah. Some people make unit tests aiming for one specific part of the function instead of having a bunch of assertions in a single test precisely so they don't have to touch old tests.
If you're mocking stuff, minimize the amount of them either by increasing the surface of the unit tests by including other classes or by writing integration tests instead. It's basically guaranteed that you'll have to keep an eye on mocks and you might miss on bugs because the mock doesn't reflect the behavior of the object after you do some refactoring. Do not believe people who claim that every class has to be 100% isolated, you'll fucking hate yourself otherwise and won't feel like refactoring.
>>105552322If you have so little code that copy pasting the code inline is noticebly faster then it's because the relative cost is higher when you don't have a lot of things going on, the average frame time should be around 13 ms. You are claiming that your function calls in total are around 1.3 ms in a release build? That would need to be something like 5,000 function calls that you are manually inlining and there is absolutely no prefetching going on, your cache is completely trashed etc. If your game is just some shitty free spinning loop that happens 10,000 times a second then you might notice a few function calls because now 0.01 ms is "noticable" so inlining 50 function calls could do that.
>>105552611Or it means that his compiler is shit.
>>105552439Ahh so it's a personal preference on your part and you were lying through your teeth when you gave that answer. Now it's coming out. Anything else to add?
>>105552701You should put your brain into a blender and ask a doctor to inject it into your bloodstream because there's clearly a bottleneck between your head and the rest of your worrhless body, especially those brown hands that wrote your post.
>>105533853Could you please illustrate your point? Not quite familiar with file mapping.
>>105551714Aggresive inlining bloats program size and you will need more cache / pages to hold duplicated code and such tradeoff may or may not be worth it to just calling the function.
>>105552322You don't want me schizoing out over C++'s code generation, right?
Right?!
>>105552957WTF I hate fread now!
...
Wait, but why don't people massively use mapped files for reading then? It seems like they're the best tool.
>Array-like access>Linear memory >Thread safe without any locksWhere's the pitfalls?
>>105552997Same reasons they don't use VirtualAlloc/mmap directly to manage their memory:
- they don't know any better (because their teachers were incompetent).
- they don't want to know any better (because then they got no one else to blame for slow performance but themselves).
- there are instances when file mappings end up being slower than direct I/O, namely when the file in question is bigger than your RAM and you write to it non-sequentially. Most programs don't do that to begin with.
From hackernews
>I wish people used mmap less.
>Creating a new memory mapping can be pretty expensive! On both Windows and Linux, it involves taking a process-wide reader-writer lock in exclusive mode (meaning you get to sit and wait behind page faults), doing a bunch of VMA tree manipulation work, doing various kinds of bookkeeping (hello, rmap!) and then, after you return to userspace, entering the kernel again in response to VM faults just to fill in a few pages by doing, inside the kernel, what amounts to a read (2) anyway!
>Sure, if you use mmap, you get to look at the page cache pages directly instead of copying from them into some application-provided buffer, but most of the time, it's not worth the cost.
>There are exceptions of course, but you should always default to conventional reads.
>>105553063>Another problem with mmap is that there is no good way to handle I/O errors.>The application will get a signal (SIGSEGV/SIGBUS, can't remember), and no information about what the problem could possibly be. Most applications do not catch these signals and will instead just terminate.>Even if you do catch the signal there is a real challenge to know what caused the signal and to keep consistent book-keeping to be able to perform any sane action in response.>At a previous employer we started seeing this problem when scaling things in production which was no fun.
>>105553063>On both Windows and Linux, it involves taking a process-wide reader-writer lockWindows pages stuff in lazily, but you can use PrefetchVirtualMemory to avoid mode switches and page faults. On Linux you can use MAP_POPULATE.
>>105553153>PrefetchVirtualMemoryI am ignorant, is this somehow related to _mm_prefetch and __builtin_prefetch or what?
>>105553153Yeah, and how to properly use PrefetchVirtualMemory and when? The official Microsoft docs suck ass at explaining stuff
>>105553163PrefetchVirtualMemory is a Win32 function that calls into the kernel (NtSetInformationVirtualMemory syscall) to tell it that the provided memory region will be used very soon, and to page it in.
__builtin_prefetch => CPU-independent vesion of _mm_prefetch, which translates into PREFETCHNTA of PREFETCHTX instructions on x86/x64. These instructions don't cause paging, but instead hint to the CPU that it might want to prefetch these. If the address isn't backed by memory, then it's just a more expensive NOP.
>>105530074 (OP)Trying to make a unit testing library for python where I can just add @Test and give an input or run the function and it will save the output of the function and automatically create all the tests.
Ideally the test output will be human readable, so when changes happen you can see the diff in version control
>>105553188>Yeah, and how to properly use PrefetchVirtualMemory and when?Don't you have the same problem with madvise(MADV_POPULATE_READ) (the more fine-grained equivalent)?
>>105552769That's some impressive rage. I've not seen anyone so angry since Cniles told Rust troons that their language will never pass a systems programming language.
>>105553063mmap is cheap, all memory is allocated using mmap, why would I listen to some fucktard drivel when I can combine mmaping a file and allocation into one syscall thanks to CoW?
>>105553373I'm going to mmap my balls onto the face of your mother if you catch my drift.
>>105553373So for read-only I/O mmap is ALWAYS better, correct? Does it make sense to align blocks in the file to the cache size?(4096 bytes)
>>105553396It's already aligned.
I've did a few scripts for work but I'm nowhere near an actual programmer. How do I properly learn? Books to read or courses to take. I'm looking more into web development (backend) + automation/integrations. My biggest problem is I know my fucking ass will abuse copilot because I'll be stuck in something and refuse to figure it out.
>>105553396>So for read-only I/O mmap is ALWAYS better, correct?What's the alternatives?
>maintaining your own copy => congratulations, now the kernel has to handle two sets of pages>maintaining your own copy using direct I/O => now the mapping cannot be shared with any other process>direct I/O => hope you enjoy loading the same shit from mass storage over and over again, via syscalls and copies
>learning c# and WPF
>tutorials start off simple
>necessarily spend 15 minutes explaining what a string is
>spend 30 minutes on what the bits of VS 2022 are
>millions of examples of console.writeline and console.readline even though it's a wpf tutorial
>methods classes are shorter for some reason despite being slightly more complex
>Anyway this is the MVVM model and here's a bunch of random shit that we're doing something something view model model view model model view view model model on repeat for barely 5 minutes
>now you know how to program with c#!
I'm beginning to suspect no one really knows how to properly explain concepts that are less simple than 'here's how to write to the console'.
>>105553873Welcome to programming. Throw shit at the wall until you're a master of throwing shit at a wall (the insult others who aren't as good at throwing shit as you are).
>>105553555I think my biggest problem is I have an idea for a project and it's kinda like okay I can do x,y,z but that sounds like too many steps, that's stupid. Then I'll AI it and it'll be like just do X -> Z and I'm like yeah that makes sense and it's more sellable but it doesn't really feel like I'm learning much except prompting. I mean I guess I'm learning a bit by osmosis.
>nostdlib
>interacting with local x11 is easy enough
>need mesa for GPU access or write my own drivers
>even if I theoretically succeeded in rewriting all drivers, modern GPUs need proprietary ZOG approved and signed blobs
software renderer it is
file
md5: 64ce8e4d112fd73463234664ab2d291b
๐
>>105553886Thanks that makes me feel better.
It just reminds me of school, spend shit loads of time on the utterly basic shit and rush through anything useful ok bye good luck nigga!
java and python are for stinky poopoo diaper babbies (yes, babbies)
How cooked am I going to be if I mostly trimmed through the Smart Pointers chapter in the Rust book?
First time the book kinda lost me
>>105553873kek yeah it's crazy.
>this bloopblopp is actually simply a blooppoop for the pooppoop>oh a pooppoop? that's just a fartshart for the blooppoop with a cartmart but you're better off using a bloopshoop shartmart in a hurrdurr if you really need the beepboop of the bloopblopp
>>105553873>>105553943>read jeet shit>get jeet qualityEither read a book or read code + documentation.
99% of tutorials are jeets grifting for 0.1 cents a click.
>>105554247It's a pluralsight tutorial by a guy named Claudius Huber. I don't think he's a jeet but go off, retard.
>>105554268>ClaudiusWhat kind of braindamaged retards name their child "Claudius"?
>>105554268What's the point of a reply like this if you have already determined yourself that it was a garbage tutorial?
Just to save you time, you probably won't find a C# WPF tutorial that isn't jeet garbage, because C# WPF is itself jeet garbage.
>what are some non-jeet-garbage gui libraries thenYou think it's a coincidence that everything is an electron app nowadays? There are none.
>>105554490>You think it's a coincidence that everything is an electron app nowadays?>in an era where jeetcode is spammed out like shits on the designated streetshmm I wonder why everything is a shitty electron app. HMMMM
fucking retard.
>>105554490>electron>not jeet-garbage
>>105553555>>105553892Not anything wrong with using an LLM, you just need to go into it with the mindset of learning. You can usually understand more about the code if you seriously look at it and try to learn everything you don't fully understand, asking coppilot to explain or looking at the source for the function it uses can help
Ask it how to structure the app and for some google terms (RESTful app, frontend/backend, etc).
Also maybe learn functional programing, at least for me, once I understood it a lot of stuff that just didn't make sense opened up
https://www.youtube.com/watch?v=nuML9SmdbJ4
tux
md5: 4eaa7ea97dee0125350be0187768e21b
๐
A binary I compiled on one Linux computer throws errors on another computer about missing specific library versions that don't match the ones installed. How do I prevent this?
>>105554578>vidya vlogs have now sprouted a new cancerous programming themed growth2x playback speed is great and all but can we get an AI de-background-musicer? Just say it's about copyright or some bullshit
>>105554117In practice you shouldn't be using smart pointers at all as a beginner. I mean real smart pointers like Arc, Rc, Box, RefCell. Obviously you should use vecs and strings, counting those as smart pointers is a stretch anyway.
Anyway, I'd say it's still pretty important to understand the concepts. But you can come back to it later.
>>105554632>But you can come back to it later.Cool, I'll just move on to the next chapter then.
I mean I understand the idea that vecs and strings are smart pointers and I think I understood the idea of Box, Rc, and RefCell but at some point the code listings really lost me, so I wouldn't say I understood how to actually use them.
>>105554601If it's any library except glibc, just statically link it.
If it's glibc, see if you can use musl instead. If you can, just use musl and statically link it.
If not, you have to compile it on an old linux system, so that it works with old glibc versions.
>>105538875mental illness
>>105554645That's ok, you genuinely shouldn't use that crap anyway. Box and Rc and basically never useful. RefCell is basically only useful for thread_locals. Arc is only useful when doing some kinds of hardcore concurrent or async code. You should't have to worry about any of this for several years, hopefully never.
>>105554601By not being a kike and giving user the code, at which point if it doesn't work, it's a skill issue.
>>105554601Ship with your libs (not glu or system shit like that) in the same dir. Patch the rpath.
>>105553873This is because Micro$oft can't stand still for more than 5 minutes before renaming .NET and changing the apis for GUI shit and web shit. Job security if you're a C# shop with hostages I mean customers.
>>105554646It's just libjpeg. I have .so.8 on the source machine and .so.62 on the target.
>>105554810I am the only user, smartass. I am trying to run the code on an ancient piece of shit that would take ages to compile on.
>>105554712>You should't have to worry about any of this for several years, hopefully never.big relief
>>105554712Why did Rust come up with all this nonsense again, if not to spite C++? And why wasn't getting rid of C's malloc nonsense sufficient either?
Opions on java EclipseStore? I saw this in the last 24 hours.
https://youtu.be/o_7CrOVVeoY?feature=shared
>>105554601compile against the most ancient version of the lib that still works.
>>105554578thanks anon, I appreciate it. I just feel kinda fraudulent doing this. I've advanced way faster in my projects with copilot compared to doing this solo and maybe I'm learning via osmosis (i mean I would've just googled copy and pasted the code) but I'm mostly looking if there's any other books for "best practices" and what the hell am i actually typing. I could ask copilot but I don't want to burn through my free code stuff or ai credits or whatever it is.
so dumb java stopped including javafx in the standard sdk because I'm always jumping through hoops to get it to work
>>105555939java swing, sar
>>105555539>18 seconds in>insufferable accentDropped.
added image decoding through ffmpeg pipe for my image viewer to support more formats
going to do the same for my music player
>>105556781where the fuck are her nipples
>>105545846Thanks anon. Used Kate.
I'm using a JSON library in C (yajl) to parse some GLTF (not important), and the library operates by using a callback every time it processes a token.
static int gltf_double(void *userdata, double val)
{
// ...
return 1;
}
static const yajl_callbacks gltf_callbacks = {
.yajl_null = gltf_null,
.yajl_boolean = gltf_boolean,
.yajl_integer = gltf_integer,
.yajl_double = gltf_double,
.yajl_number = NULL,
.yajl_string = gltf_string,
.yajl_start_map = gltf_start_map,
.yajl_map_key = gltf_map_key,
.yajl_end_map = gltf_end_map,
.yajl_start_array = gltf_start_array,
.yajl_end_array = gltf_end_array,
};
yajl_handle yajl = yajl_alloc(&gltf_callbacks, NULL, &state);
I was starting to write a somewhat bloated state machine to handle all of the keys I was expecting, but then it occurred to me, why don't I just fuck with the callback table itself instead?
If I encounter the "scene" key, I change the integer callback to a function that writes the value somewhere (and the others to error out) then restore the table to what it was before.
Is there anything wrong with doing it this way? Is this how people actually use these kinds of libraries?
>>105557087this api is terrible
it should provide the path to the current value as a callback parameter
use another library or write your own json parser
>>105557141I was originally looking at libraries like json-c, where it basically builds the entire tree in memory, which you then traverse. It seemed a bit excessive; I don't need to create a bunch of hashtables, since I'm working with a standardized format.
>the current valueI mean, that's what I was originally going to do, but once I started writing out
enum gltf_state {
GLTF_START,
GLTF_TOP_SCENE,
GLTF_TOP_SCENES,
GLTF_TOP_NODES,
GLTF_TOP_MESHES,
GLTF_TOP_BUFFERS,
GLTF_TOP_BUFFER_VIEWS,
GLTF_TOP_ACCESSORS,
GLTF_TOP_ASSET,
GLTF_SCENE_NAME,
GLTF_SCENE_NODE,
GLTF_SCENE_EXTRAS,
// ...
};
I realised that god damn there are going to be a lot of states, and the functions are probably going to be fairly messy. I guess I bunch of them can be cut down by just storing the key, but that just adds a bunch of extra string comparisons everywhere. That's when I got the idea of just changing the function pointers.
>>105554601set rpath up for local shared object loading, bundle library
same way windows programs do it
Any of you schizos worked with Qt before?
>>105530074 (OP)I added Text To Speech for 4chan threads
Here is a reading
https://voca.ro/16czryMpnexI
of the thread
https://ayasequart.org/g/thread/96520802
in op_and_op_replies mode. DFS, BFS, and OP only modes are available too.
>>105530074 (OP)Nothing. Just lamenting the loss of /prog/.
>>105557660The code lives here, btw
https://github.com/sky-cake/ayase-quart
>>105555052Maybe fix your project to be better than bloated tranny slop, and it will work fine on your obsolete hardware like it was built yesterday.
mmap-sama, are you still here?
https://www.reddit.com/r/cpp/comments/1l89aft/when_is_mmap_faster_than_fread/
Sorry for posting r*ddit, but they say that mmap is almost always LE BAD for both performance and memory consumption (somehow) and you should use either conventional I/O instead, or io_uring or ring buffers. Is this true? Or they got it all wrong? There are too many different opinions that completely cancel each other out I can't figure it out.
cleared last outstanding bug by deciding that it's WONTFIX
>>105558475io_uring requires fixed buffers and userspace caching. Where you will put those buffers into? A mmap?
Normal fread is always garbage due to not being OS level API.
Conventional I/O is same as io_uring, but now entirely synchronous with syscall overhead, double that if you need non-sequential access.
>>105558780>Normal fread is always garbage due to not being OS level APIBut it provides automatic buffering over ReadFile/read() syscall. Or do I need to do manual buffering myself over read()?
>>105558860Why would you want extra copying?
>>105558860>But it provides automatic buffering over ReadFile/read() syscallAnd how does its data end up in your buffer? Oh, that's right - another copy.
Sounds kinda retarded now, doesn't it.
I'm trying to learn Qt.
Am I approaching this in the right way?
Assuming I want the text inside the dialogue box to be maintained.
Also what's the best way to learn. I've watched voidrealm's videos but I don't feel like shelling out money for a proper udemy course. I'm just trying to piece together things from the docs and example projects rn
>>105558780Another hot take
>mmap can potentially trash the virtual page cache depending on the access pattern. I usually find pread (which is thread safe) more robust and reliable than mapping the file, also you can open the file with O_DIRECT to bypass cache if you will only read data once.
>>105558927>mmap can potentially trash the virtual page cache depending on the access patternmadvise(MADV_HUGEPAGE)
>>105558940Noted, thanks. What about the unpredictable page faults that they scream about? Does madvise solve this too?
>>105558978madvise(MADV_POPULATE_READ)
>>105558927Oh no, not my heckin virtual page cache when a cold page fault takes less time than reading from file directly off the disk...
>>105558940>>105558990Neither of these are useful for file I/O.
>>105558978>unpredictableWhy would anyone need to worry about this even if it were true? (it isn't)
>>105559064Excellent argument, Dunning Kruger, you changed my objective mind.
>>105559073Why would I need to change the mind of an idiot?
>>105559082Because that would change you from an idiot to a passable midwit. You're a retarded hugepagetranny, so you won't understand anyway, but here it does: huge pages don't share page cache with normal pages, you're wasting RAM and reading big blocks, virtual page cache is a non-issue and if you weren't a retarded nocodeshitting tranny, you'd know this.
I think you are what they call "BTFOed".
>huge pages don't share page cache with normal pages
Yes they do.
>visual studio 2022
>try to call method
>typing . (dot) autocomplets the fucking suggestion.
How do I turn this cunt off?
>>105557265I mean on the one hand yes it is excessive because you're right GLTF just ends up in a struct of arrays, but so is the effort you need to put in to pretend that you don't need hash tables to parse JSON. And what is the point of that effort anyways? GLTF is a fucking terrible scene format for runtime anyways so you need another layer after GLTF to put your data in anyways. I get that abstractions have a cost but unless you know EXACTLY what your data is going to be and it wont change you need some flexability.
>>105556781Nice bulge faggot
>>105560056>you need another layer after GLTF to put your data in anywaysWhat? Is this about how your in-memory representation of something isn't exactly the same as how it's serialized?
That's not a realistic concern at all.
All of the raw vertex data is storable in a GPU-ready format, so that seems good enough for my admittedly simple uses.
>but so is the effort you need to put in to pretend that you don't need hash tables to parse JSONGeneral purpose handling of JSON, sure. But I'm not trying to keep it general purpose. glTF is rigid enough that I don't need it, with the "flexibility" being if something is present at all, or just JSON being in different orders.
But man, trying to do it this way with a callback-based library is turning out to be a fucking mess, which yeah, isn't worth the effort. It's just turning into a fuckhuge state machine where control flow is jumping all over the place.
I'm going to look at some other libraries, and if I can't find what I'm looking for, just use json-c or whatever and build the tree.
>>105560292in my own json parser itโs mostly stateless and the only state is the reading position
for formats where the path to the value i want to extract is known i just do something like char *c = json_path_get_value(json, โpath.to.valueโ);
for (char *v = json_array_first_value(c); v; v = json_array_next_value(v))
dothing(v);
>>105560292I like jsmn, but you'll end up needing to write your own tree traversal for it. Frankly, you should just use json-c, since it's mature, easy, and I guarantee your json parser isn't going to be your bottleneck. If it is, you need a redesign.
>have a Rust project
>one file contains a pair of complex decoder functions
>these handle the most common cases themselves
>also have ten large sub-functions that handle lots of weird edge-cases
>put the sub-functions into a separate file
>1.6x speedup
>LL parsers are LE BAD! b-because it just is goy! invest in LR instead
Just design your grammar correctly holy shit
>>105530074 (OP)Is there anything in Jetbrains settings where I can keep the fucking completion hints and stop the fucking right box from showing?
>>105564075why would you want just the first one, though? like, when do you need to type just a method name but without the parameters? not criticizing, just curious
not a Jetbrains user but seems tidy and ergonomic to have a list of function names and then all their overloads on a secondary list. i'd use this mode in Eclipse for Java
>>105564162Honestly it's just very distracting for me. If I know what method I want then the overloads on the side just waste space and attention.
stlb
md5: 18b31cb6243e62113a7749af55ddd844
๐
So I made a first fit allocator to use alongside my arena allocator, for when arena allocation is not an option.
It's not a pure first fit allocator because it defaults to mmap for big allocations, it's really a very simple general purpose allocator.
The qeuestion is what do I call it? (the function prefix) I don't want to override malloc and it has a slightly different interface anyway.
>>105564829>packwhat? but why? this doesn't carry the idea that it's "general purpose" or that it's fine for any lifetime
I'm thinking that "global_" could be apporpriate
>>105564910malloc isn't general purpose either. It has the very specific purpose of providing individual lifetimes, which is a concept the hardware knows nothing about and has to be emulated in software.
>>105564952I know, there is no such thing and mine isn't either, that's why I quoted it. It is also made for sporadic individual lifetimes, it's not made for intensive use.
>>105564976Why not "hospital"? Lots of individual lifetimes in there.
>>105565042Or maybe "hood"? Lots of trash around that belongs to someone else.
Zig uses the diminutive gpa for GeneralPurposeAllocator, this seems alright.
https://zig.guide/standard-library/allocators/
>>105564683>it's really a very simple general purpose allocator.gpa
maybe aa or aua (augmented allocator)
>>105564683FirstFitAllocate
70e
md5: 761113d2ea37c804537ef6e0b5204ed4
๐
>>105566397>alloc_free()>>105565823yep, that's what I chose
Working on a cross-platform 4chan app
So what complete retard came up with the idea of making malloc allocate memory via mmap if the requested size is over 128 KB?
>why is it retarded
Have you looked at the address malloc churns out? It's not page aligned. malloc wastes an additional page at the end because it INSISTS on adding its own state at the beginning of the allocation.
At what point will people realize that malloc was a mistake?
>>105567602>it INSISTS on adding its own state at the beginning of the allocation.How else is it supposed to know the size of an allocation upon reallocating and freeing, genius?
>>105567736Not my problem.
>>105567602Large allocations are page aligned automatically.
Small allocations are within a pool that is page aligned.
Please don't get so angry.
>>105567778Are you paid to spread misinformation?
https://godbolt.org/z/qc3K59xPa
4K: 0x2c6ec2a0
2MB: 0x718b1abff010
16MB: 0x718b19bfe010
>>105567865You sound like a malloc user, which is the worst insult I can think of.
>>105567817CE is not using mmap, and please, like I said earlier, this is a vibe thread and you're killing it with your aggression.
>>105567922No one cares about your CE. Or your vibes, for that matter. I hope they all get killed.
>>105567871you complain about what malloc does but you didn't present a better solution
as usual, useless post, waste of time
>>105568107Are you stupid?
>>105568362Has to.
He's defending malloc, after all.
>>105568520>>105567760Just don't use malloc. It's easy.
>why yes I will take advice from a place full of proven retards instead of relying on industry standards developed over half a century
>appeal to authority
Wow, you're retarded.
file
md5: 9ea38619ea46da9791ae28eb0768f612
๐
New Rust book dropped: "Rust for Sศฏyjaks"
/g/ has no excuses now
Are there middleman services that put your app up on google play so that google doesn't dox you to everyone?
>>105568538That's not what you said. You said that it was stupid for malloc to put metadata. So where is it supposed to put it and how does it looks up the metadata upon freeing?
>>105568702*to put the metadata before the allocation
>>105568702>That's not what you said.>At what point will people realize that malloc was a mistake?
>>105568711You are avoiding to respond to the question again and changes the subject. I accept your concession.
you're not a schizo, you're a faggot
>>105568738You have your answer. malloc is hot garbage, and its users are retards. That includes you, so your judgement is so invalid on top of everything else it's actually makes me feel pity for you.
>>105568746No I'm not using malloc,
>your judgement is so invalid on top of everythingwhat judgement schizo? All I did was ask a question that you never answer.
take your meds and SHUT THE FUCK UP fucking little bitch
>>105568764>No I'm not using mallocWhy else would you defend it? Retard.
>what judgement>schizoYeah, like that. Who cares what a retard like you has to say.
>>105568784>Why else would you defend it? Retard.I was pointing out that what you said was idiotic, you dumb motherfucker.
>Who cares what a retard like you has to say.Apparently you do since you reply to me.
>>105568862How would you know what I said, considering you didn't read the post to the end? Retard.
>Apparently you do since you reply to me.I'll take any chance to publicly humiliate and insult you.
Retard.
>>105568882attention whore
>>105568538Ok, I will use _mm_malloc instead.
>>105568926If it's good enough for Intel, it's good enough for me.
>>105568926>can't reply to a question because too retarded>still answers because he likes attention
>>105568933no the anon whose vocabulary mostly consists of the word "retard" (some kind of projection) knows better than intel
>>105568935>so retarded it doesn't understand an answer if it's giving to it>still replies because it's just so retardedRetard.
>>105568933Double retard.
>>105569069Yup, that's optimal allocation code, I use it all the time.
>>105569153Triple retard.
>>105569202Seethe, nocoder.
>>105569229>retard nocoder which is a retard with invalid opinions calls others nocodersClassic.
>>105569250Post your allocator, you have 5 minutes.
>registry dumber is high enough to look down on others
>not high enough to avoid his flight control system from telling him to retard the throttle
>.015s
Not bad for a toy that doesn't need to exist in the real world.
I can see why other people think you're a retard.
Imagine trying to prove how good you are at something by producing the absolutely most useless showcase for it
How would a nocodeshitter like you know? You've never done anything in your life.
>>105569813how many people have used your registry dumper?
>attempt to change the topic
Denied.
ego shattered by the simplest of questions
Yeah, you can tell "nocodeshitter" really hit a nerve.
ad hominem don't hit anything, it's just noise
if anything, it proves complete lack of counter-arguments
Is that why you were desperate to change the topic? LOL
>again desperate attempt to change the topic
The fun never ends.
For me.
>>105569960topic was proving proficiency with a useless implementation
insulting posters is not a topic
failing to answer an on-topic question by deflection or ad hominem is a form of steering away from the topic
>>105570008I know you're retarded and don't, but I want to know what you'll say: do you know what projection is and how it works?
No, Ivan. *The* topic was that you being a nocodeshitter renders you utterly incapable of such judgement in the first place, and there is nothing you can do about it.
So simple.
>>105570019yeah, like the reply
>>105569813 to post
>>105569780or reply
>>105569882 to post
>>105569869those are some examples of projection
>Ivan doesn't understand it's not projection if it's true
>>105570051If you know this, why are you responding then, moron.
>>105570056people projecting always think with great conviction their projections are true - that's one of the defining points of it
so you only further confirm and validate it was, in fact, projection
dump
md5: bb8c2a710e58f52d26f15b5be94d460d
๐
Still waiting for your implementation to prove you're not a nocodeshitter. 500 MiB, 10 seconds. Go.
Please do not engage with the homeless schizos.
>>105570164you have made the mistake of thinking anyone cares about you throwing insults at others, especially for not engaging in writing such a useless program (useless because it has no users or usecases - feel free to prove otherwise). you're like the kid who tried to be the school bully but no one bought it and instead all made fun of him
if you took time to reflect how these threads have been going for the last months, you'd realize how it has backfired on you - no one ever engages in your "challenge", no one cares about being called a "nocodeshitter" or whatever by you, while you yourself have earned the label of "regdump schizo"
at this point the only kinds of engagement you can count for is more trolling and jabs at your futile workpiece
no one will really stop you from your endless insult replies, just be aware that you're not making a dent on anyone, no matter how hard you seethe at everyone
Sorry, my currency of choice isn't empty words - only code. Which is why nocodeshitters like you are worthless to me.
>didn't even read two sentences of your post
>>105570437now post that again without crying
See, Ivan, now THAT is projection.
>>105570524Your schizo behaviour of stopping replying to posts doesn't show that.
>>105570437So where/s the code? Post direct link to the repo.
>>105570777What, and have some nocodeshitter steal it without having to put any work into it? I have already provided enough proof of the existence of the code and its results than /dpt/s autistic wafflers have any right to.
>>105570823I see that you're severely mentally ill just from that snippet, don't post anything else, ever again, schizo.
hexes
md5: eb9a4e0fb9638e87ccb6ac2fb7773a6e
๐
>another incompetent nocodeshitter with another strong opinion
Hold the presses.
Good afternoon, Ada chads.
Reminder that basedlangs don't have a LOLITA.