[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 / qa] [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: 1708167092944665.webm (2.96 MB, 600x338)
2.96 MB
2.96 MB WEBM
What are you working on, /g/?

Previous: >>101943127
>>
What's a good up to date resource for learning Ruby? I'm looking to brush up on my skills
>>
>>101979860
its documentation, retard
>>
>>101979603
you just knowpantsu
>>
>>101979603
>What are you working on, /g/?
MaidchanBBS
>>
>>101980025
you post trash
i comment on it
mald garder
>>
>>101970136
Then I didn't understand the algorithm you have in mind. I thought I would have to compute the difference in pixels for each configuration, so I don't see how "99.99% cases will check only one pixel before moving to another configuration".

>>101979096
>Did you use cv2.findHomography
No, but it looks promising, gonna look into it, thanks
>>
File: 1724100166044.jpg (2.61 MB, 2509x1411)
2.61 MB
2.61 MB JPG
Currently on catacombs of the class. Using it as a way to brush up on my c sharp and to learn rider.
>>
Rate my babby's first assembly fizzbuzz:
.global _start
.intel_syntax noprefix

.text

_start:
mov rbx, 1
mov rdx, 0

_start_loop:
cmp rbx, 100
jg _exit

mov rax, rbx
mov rcx, 3
cqo
div rcx
mov r8, rdx

mov rax, rbx
mov rcx, 5
cqo
div rcx
mov r9, rdx

mov r10, rdx
or r10, r8

mov rdx, 9
lea rsi, [fizzbuzz]
cmp r10, 0
je _print

mov rdx, 5

lea rsi, [fizz]
cmp r8, 0
je _print

lea rsi, [buzz]
cmp r9, 0
je _print

_print_number:
mov r8, 1
lea rsi, [number+20]
mov rax, rbx
mov rcx, 10

_print_number_loop:
cqo
div rcx
add rdx, 0x30
dec rsi
mov [rsi], dl
inc r8

test rax, rax
jz _no_more_digits
jmp _print_number_loop

_no_more_digits:
mov rdx, r8

_print:
mov rax, 1
mov rdi, 1
syscall

inc rbx
jmp _start_loop

_exit:
mov rax, 60
mov rdi, 0
syscall

fizz:
.ascii "fizz\n"

buzz:
.ascii "buzz\n"

fizzbuzz:
.ascii "fizzbuzz\n"

.data

number:
.space 21, 0x0A
>>
Haskell!
>>
File: oop vs fp.jpg (393 KB, 1080x1489)
393 KB
393 KB JPG
Reminder that OOP is a clever scam invented by boomer programmers to give themselves an endless amount of busy-work. You were never supposed to use it when you actually need to get stuff done.
>>
File: 2bb4.jpg (9 KB, 250x187)
9 KB
9 KB JPG
can you do fizzbuzz in make?
>>
>>101980847
And yet OOP is what powers the entire world and LISPs are only written by some fat incels.
>>
annoying how poorly my programming skills transfer to new languages
I can write in a day low latency allocation free code that would take a typical dev a week to do in C#, or a complex WPF app, but switch to JS and React and it's the opposite
really hope I get past some kind of hurdle with this webdev junk soon at which point it becomes easy
>>
>>101980847
solve2225 :: [[Int]] -> ([Int],[Int])
solve2225 ms = let
byLosses :: [(Int, [Int])]
byLosses = map (\ g -> (snd (head g), map fst g))
$ groupBy ((==) `on` snd)
$ sortOn snd
$ M.toList
$ M.fromListWith (+)
$ concat
$ [ [(winner,0),(loser,1)] | [winner,loser] <- ms ]
g n = fromMaybe [] $ lookup n byLosses
in over each g (0,1)

The java is FP.
>>
>>101980976
anon, makefile is just a wrapper for shell scripts. Can you do fizzbuzz in bash?
>>
>>101981338
>winner,loser
Those should be w and l you haskell tertiary
>>
I wanted to write Windows 1.x drivers today for a really stupid project, but it turns out that the DDK is MIA.
This is really unfortunate.
>>
>>101981378
inb4 it should be zip [0,1]
>>
File: file.png (54 KB, 1042x730)
54 KB
54 KB PNG
>>101981370
but make also has control functions & conditionals. I think you could probably do it without calling any external programs
>>
>>101979290
>can I using declaration a parameter pack/list?
Not sure if it's possible with only a using declaration, but you can do something like this
template<typename... Args>
struct A
{};

template<template <typename...> class T, typename U>
struct Helper; // leave undefined

template<template <typename...> class T, typename... Args>
struct Helper<T, std::tuple<Args...>>
{
using type = T<Args...>;
};

template<template <typename...> class T, typename U>
using helper_type = Helper<T, U>::type;

using AttributeSet = std::tuple<int, float>;
using SubType = helper_type<A, AttributeSet>;
//or just use it directly
using SubType1 = Helper<A, AttributeSet>::type;
>>
File: yotsuba.jpg (204 KB, 688x610)
204 KB
204 KB JPG
TCP: how would you handle bit-flips in your data? (since TCP checksum is trash).
Yeah, application layer checksums, but how to implement it, and how to signal retransmission request? It's easy if every packet is the exact same length, but what with variable-length data?
Say you have constant size header with 'body length' and 'checksum' field, if 'body length' gets bit-flipped we can't even grab the whole message correctly, if it's less then we get desynced with the server, if it's more then we are waiting for data indefinitely.
Easy fix, store two checksums: one for header, one for data. Receive header first, if checksum matches, the 'body length' is right, so we can proceed with receiving data. But what if there's a header checksum mismatch, how do you handle that? I'd need to signal retransmission to the server, but for this i'd need to make sure that receive buffer is flushed from the previous request, without knowing how many bytes i need to read to flush it...
The only good way to solve it that i can think of is terminating the connection and establishing a new one.
>>
>>101982240
>The only good way to solve it that i can think of is terminating the connection and establishing a new one.
this.
Also, ACK all the jews. just btw
>>
File: file.png (8 KB, 463x127)
8 KB
8 KB PNG
>>101982207
I found a nicer solution with just one struct, picrel, usage:
using SharedParams = TParamPack<Arg1Type, Arg2Type>;
using SubType1 = SharedParams::PassTo<Abc>; // equivalent to Abc<Arg1Type, Arg2Type>;
>>
File: odinprec.jpg (23 KB, 1255x200)
23 KB
23 KB JPG
I'm not sure this means
How do you convert a float to an int without precision loss? Or it remains a float?
>>
>>101982240
Yeah, I'm baffled by my experiences with TCP implementations. I've never come across one that has the means to purge the buffer or check if the buffer is fuckin' empty without locking the system to await another transmission.
>>
>>101982531
yeah that's a lot cleaner
>>
>>101982578
it's a whole number/all the significant figures are to the left of the decimal point and also the value fits in an int
it does only say literals so this isn't a bad thing to do it like that
>>
>>101982578
Precision loss of the value, not the type
int can't represent every value float can (or vice versa), but it can represent the specific value a float literal "1.0" represents (so a one)
>>
>>101979603
sex
with yukari-chan
>>
File: odiniterats.jpg (48 KB, 684x817)
48 KB
48 KB JPG
Does this look like a fine language to you?
>>
>>101982716
no
>>
>>101982716
no, where's the let
>>
>>101982716
>:=
cute walrus
>>
>>101982737
why not
>>
>>101982240
>how would you handle bit-flips in your data?
If you're that worried about it, use an error correction coding scheme. Tune it to the rate of errors you want to detect, the rate you want to automatically correct, and just how much overhead you are willing to tolerate.
Otherwise, you need to design the message framing (within the TCP stream) carefully so that you have a chance to reestablish the boundaries on things going badly wrong.
Or use UDP. UDP is way messier than TCP, but the framing into individual messages is there for you. (By "messier" I mean that packets get dropped and reordered and even occasionally duplicated. Yes, this has been seen in deployed code. Packet corruption happens at the same rate as in TCP but you get to see more of the other shit that goes on down there.)
>>
>>101979860
just read Programming Ruby 2.0
>>
>>101982621
>I've never come across one that has the means to purge the buffer or check if the buffer is fuckin' empty without locking the system to await another transmission.
Enable non-blocking mode. Duh!
>>
>>101983728
>Dave Thomas
No thanks I'm not taking Ruby advice from the burger guy
>>
>>101979603
Anyone got any recommendations for an ncurses-like or ncurses wrapper for Nagoor Babu's preferred programming language? I already found https://jexer.sourceforge.io/ and was originally intrigued by the anime pictures in the demo pics, but when I scrolled down and discovered that the author unironically wears programming socks, I'm having second thoughts.
I recognize that my use case is pretty niche though, so I guess this is my curse to bear.
>>
>>101979603
licking yui's little bean
>>
>PCSX2
>written in C++
>near call (0xE8) => far jmp (0xFF) => near jmp (E9)
>just to call memmove for 19 bytes
>issues a vzeroupper before the call, too
>when it should've been optimized to a simple
vmovdqu xmm0,xmmword ptr[foo]
mov ax,word ptr[foo+16]
mov cl,byte ptr[foo+18]
vmovdqu xmmword ptr[bar],xmm0
mov word ptr[bar+16],ax
mov byte ptr[bar+18],cl

>would've been easier on the instruction cache, too

C++ devs are somehow smart enough to wade through all the levels of abstraction bullshit the committee and the language throws at them, but are also somehow stupid enough to believe the snake oil salesmen about their claims that the optimizer can work magic.
>>
>>101984741
Actually, fuck that, it's even simpler:
vmovdqu ymm0,ymmword ptr[foo]
vmovdqu xmm1,xmmword ptr[bar+19]
vmovdqu ymmword ptr[bar],ymm0
vmovdqu xmmword ptr[bar+19],xmm1
>>
File: namedresults.jpg (51 KB, 1131x516)
51 KB
51 KB JPG
Thoughts on this?
>>
>>101985035
cancerous
>>
>>101985035
No one cares. Literally no one.
>>
File: odinexplicit.jpg (101 KB, 1107x718)
101 KB
101 KB JPG
>>101985248
what about this
>>
>>101985281
Doubling down doesn't help you.
>>
>>101985321
I guess nobody discusses programming on the programming general
>>
>>101985327
If that programming amounts to complete garbage: yes. We already have enough garbage to deal with anyway.
>>
Are KDE distros the only ones where font rendering looks decent?
>>
>>101985360
You just hate odin for some reason. It's just programming language concepts, which I haven't seen in other languages
>>
>>101985389
More like that it doesn't warrant any attention, as it's just another waste of time and effort that doesn't solve any actual problems.
>>
>>101985426
It's quality discussion unlike most of the trash here
>>
>>101985035
somewhat goofy and any form of implicit return like that is bad

>>101985281
but that's actually kinda nice
>>
Just learning python, finished a tkinter tutorial so I'm playing around with sqlite trying to figure out calling individual databases
>>
what programming language would an evil genius use?
>>
>>101985035
Pointless.

>>101985281
So I can't add my to_string implementation for a custom struct if I import to_string from somewhere else?
>>
>>101985437
It's discussion about garbage, plain and simple.

>>101985464
According to the Rust people: a mixture of C and assembly.
>>
>>101985460
Good on you, anon.
A lot of people shit on python, but it's good for people that are just starting out.
>>
>>101985361
font rendering at >= 720p but < 4K will always suck because most fonts aren't struck or hinted to be displayed without smoothing (which would be better at <= 1080p) and because font smoothing just fucking sucks (but is necessary for most fonts at > 720p < 4K).
>>
been banging my head against the wall this past week trying to convert some sse2 intrinsics to altivec.
>endianness bugs
>gcc bugging out overloading keywords
>ibm's poor documentation that they can't guarantee isn't a virus
i'm about to give up
>>
gonna see if i can't do something stupid with named register variables
>>
>>101987951
>something stupid
You're better off using raw assembly blocks. Those don't trigger reordering or preserving.
>>
>>101982621
even if you would purge the buffer at this very moment, there's no guarantee that the server hasn't finished sending the data from the previous request yet. Say you've detected a checksum mismatch in header, but the message would contain 1GiB of data after the header. On 1Gbps link, the server will still be sending data for at least 8 seconds.
>>101983723
thanks, ECC and UDP sound interesting, i'll consider them.
>message framing (within the TCP stream)
from what i understand i'd have to use some constant length messages, or in my example acking the header with 'body length' first to the server, only then for the server to send actual body. I see this could work for many things, but as i'm writing a network filesystem this would introduce some latency.
Think for now i'll just treat bit-flips as a very rare exception and panicking by reestablishing a new connection should be fine for very low rate of bit-flips. I'm yet to see an actual bit-flip that wasn't injected by me.
>>
Does C++ have an equivalent to Self (type of current object)
>>
File: 33619221.png (13 KB, 525x220)
13 KB
13 KB PNG
trying to use python through visual studio. how do I get it to run the python script from the actual location it's in?
running os.getcwd() returns somewhere different
>>
>>101988245
wouldn't volatile take care of that?
then again you're probably right, the register in question is the exec control mask which turns on/off vector threads and i should probably be as careful as possible

>>101988467
using this_type_t = decltype(*this);

with C++23 due to people getting fucking tired of having to write so many identical overloads per function for each permutation of function qualifiers they added explicit this and type deduction on top of that
it's whatever reference parameter is preceded by the this keyword and gets rid of the implicit declaration context you normally get in member functions
struct some_type{
template<typename Self>
void all_qualifiers(this Self&& self);
};
>>
>>101988467
using Self = std::remove_reference_t<decltype(*this)>;
>>
>>101988794
>wouldn't volatile take care of that?
Certainly not of preservance. If you let the compiler know you'll use xmm9, then it WILL preserve that register (a.k.a. push and pop it). The only way to prevent this (and do some really "stupid" things) is to not tell the compiler.
>but isn't that a good thing
Possibly. Potentially. I certainly would want the compiler to preserve general-purpose registers, but anything else has a chance of being juuuuuuuuuuust fine. Just to be save I would try to avoid as much non-first-party-code as possible, because even a simple memcpy can have devastating effects.
>>
>What are you working on, /g/?
trying to web scrape a grocery site to track prices. I am trying to push myself to scape more advanced sites instead of only using requests and bs4. Now trying selenium

Right now I can get the information for 4 pages but I get kicked off after that or sooner.

I'm gonna try looking at their backend API again and getting an API key somehow
>>
>>101988952
i'm working on the GPU so it's a bit different, but see now that was my reasoning behind thinking this might work for this one register
exec being the vector lane control register (like having a register that causes instructions to ignore parts of the x86 simd registers instead of having an additional bitmask operand) it's expected to be fucked with, all the time, by everything

doesn't seem to have worked so i'll probably go with chaining functions with inline ASM blocks
also lmao i triggered an assert in the compiler backend while writing testing code
>>
>>101989452
actually never mind it did work
>>
>>101988467
What's the usecase? Inside the concrete object you know which type it is, and inside the template you get the T.
>>
>>101984741
>no reaction by the C++ crowd
... you know that feeling when you regret having wasted your virginity on someone? That's what I feel like with C++ - wish that pile of garbage had never been my first.
>>
File: 1708216667739000.png (25 KB, 743x216)
25 KB
25 KB PNG
>>
>>101991301
Now do that again, but without triggering malloc/new or memcpy.
>>
>>101991396
why
>>
>>101991415
Because those two functions carry the highest hidden costs that no one wants to talk about.
>>
>>101991474
I'm printing 3 numbers anon
>>
>>101991586
And it would be a lot more impressive if it was as fast as possible. 'Tis early practice only makes the master.
>>
>>101991608
I think its a good way to get stuck on details instead of making actual progress
what's the point of optimizing things where it is objectively useless
>>
File: part_of_the_problem.png (397 KB, 828x683)
397 KB
397 KB PNG
>>101991665
>I think its a good way to get stuck on details instead of making actual progress
The progress of the last thirty years has been a downward spiral because no one got stuck on the details. Vector instruction sets and page sizes are completely fallow, while the company which came up with them in the first place is destroying itself catering to the old ways of the incompetent software developers.

>where it is objectively useless
It's only useless if you don't know how to repurpose it in future projects. That's what you should learn instead of reading and then printing out numbers.
>>
>>101991827
I'm so sorry for not having autism
>>
>>101991858
That's why I'm never nice when I rip apart people's code. They deserve every single piece of shit you can stuff down their throats and then some, until they kill themselves. It weeds out the undesirables.
>>
>>101991901
triggered the autist
>>
>triggered the unemployable
>>
>>101991901
Too bad you're retarded though.
>>
File: 75919_web.jpg (29 KB, 400x470)
29 KB
29 KB JPG
>>101979603
What's the best self-hosted programming LLM anons? I want to complete Terry's Dream of God OS and need AI Assist.
>>
>>101990885
>and inside the template you get the T.
except T is just a template parameter, you still would have to type out the entire type
>>
>>101991990
Still waiting on that version without malloc/new and memcpy. Only a retard would refuse.
>>
I've been learning F# in my free time and really want to use functional programming somewhere but my normie job only lets us use javascript and typescript for everything
>>
File: 1721373638942187.png (27 KB, 920x798)
27 KB
27 KB PNG
>>101992418
But typescript is functional
>>
increase your productivity by patching libc so every call to malloc smashes your dick with a hammer
>>
>>101992447
>he doesn't know about LD_PRELOAD
>he doesn't know about IAT patching
>>
>>101992454
criminal sins, go directly to the dick smasher
>>
>>101992465
I'm so happy no one cares about what you have to say.
>>
>>101992444
And so is javascript, but I want more robust safety features. Typescript's type erasure means that anonymous implementations of some times don't register as subclasses, for example

abstract class IFoo {
abstract bar(): string;
}

const anonFoo: IFoo = {
bar: () => "Hello world"
};

class Foo extends IFoo {
bar(): string {
return "Goodbye"
}
}

const namedFoo = new Foo;

console.log(anonFoo.bar()); // Hello world
console.log(namedFoo.bar()); // Goodbye

console.log(anonFoo instanceof IFoo); // false
console.log(namedFoo instanceof IFoo); // true


Typescript is, to me, a glorified frontend linter for Javascript and shouldn't be used to write backend code
>>
>>101992477
>I want more robust safety features
hammer time
>>
>>101991665
You just said it was printing out 3 numbers. What details are there to get stuck on? It sounds to me like you immediately retreated into defensiveness without actually considering what anon is saying. How do you think you're going to write efficient code when it "actually matters" and the problem domain is multiple orders of magnitude greater, if you can't even be bothered to do it over the most basic shit imaginable? Stop being a milquetoast worm for 5 minutes, anon. Put in the effort or don't bother at all.
>>
>>101992418
Use a transpiler
>>
I was told Go was easy, yet, I cannot fucking understand how their interfaces work, its so fucking weird holy shit.
>>
>>101992750
Most C++ devs are like that though. They don't put in the effort even IF it matters.
>>
What the fuck does {@} mean here? Is it just a typo in this book? I can't find any assembly reference that even mentions this symbol.
>>
>>101992098
>>101992903
There's no heap allocation at all in the example that you were samefagging to yourself retard.
>>
>>101992954
I never said anything about _explicit_ allocations, you nincompoop.
>>
>>101992954
Bold of you to assume that local rust shitzo knows anything about programming in C++.
>>
>>101992975
>>101992980
Get a job.
>>
>>101992985
I have one. It involves driving incompetent programmers into suicide, like you.

>>101992980
>he doesn't know what cout does behind the scenes
>>
>>101993014
You're just wrong and being overly aggressive about it because you're a retard, autists are assholes sometimes but they're almost always correct.
Kill yourself.
>>
>>101992954
99.97% (75,776B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->97.27% (73,728B) 0x4927281: ??? (in /usr/lib/libstdc++.so.6.0.32)
| ->97.27% (73,728B) 0x40050AD: call_init (dl-init.c:74)
| ->97.27% (73,728B) 0x40050AD: call_init (dl-init.c:26)
| ->97.27% (73,728B) 0x4005193: _dl_init (dl-init.c:121)
| ->97.27% (73,728B) 0x401B2AF: ??? (in /usr/lib/ld-linux-x86-64.so.2)
|
->02.70% (2,048B) 0x4BE3A38: _IO_file_doallocate
->02.70% (2,048B) 0x4BF2398: _IO_doallocbuf
->02.70% (2,048B) 0x4BF2398: _IO_doallocbuf
->01.35% (1,024B) 0x4BF0213: _IO_file_underflow@@GLIBC_2.2.5
| ->01.35% (1,024B) 0x4BF243A: _IO_default_uflow
| ->01.35% (1,024B) 0x49B8F00: __gnu_cxx::stdio_sync_filebuf<char, std::char_traits<char> >::underflow()
| ->01.35% (1,024B) 0x49C76C9: std::istream::sentry::sentry
| ->01.35% (1,024B) 0x49C79A7: std::istream::operator>>
| ->01.35% (1,024B) 0x1091AE: main
|
->01.35% (1,024B) 0x4BF0597: _IO_file_overflow@@GLIBC_2.2.5
->01.35% (1,024B) 0x4BF1056: _IO_new_file_xsputn
->01.35% (1,024B) 0x4BF1056: _IO_file_xsputn@@GLIBC_2.2.5
->01.35% (1,024B) 0x4BE4FFD: fwrite
->01.35% (1,024B) 0x49E66B5: std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >
->01.35% (1,024B) 0x49E6ABA: std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >
->01.35% (1,024B) 0x109198: main


trivially wrong
>>
>>101993074
>__gnu
>>
>>101993042
Can I trust you to kill yourself, now that you've been shamefully defeated, or do I need to get hired by your company to make sure you eat rope? >>101993074
>>
>>101993134
You can trust that everyone knows you samefagged a trivial shitty example so you could have an argument with other retards on 4chan.
>>
Also you're a nigger.
>>
>>101993143
So you won't. That's alright. I'll just continue to be mean to everyone, and rightfully so, because
>I'm almost always correct
>>
>>101993183
You'll continue being a dumb nigger.
>>
>>101993188
Who cares what someone who's always wrong thinks about someone who's always right? :p
>>
>>101992903
>Most C++ devs are like that though
I've found those "C++ devs" are often people who come from other backgrounds, like C# or Java. My coworker is like that. I once caught him committing code where he wrote a getter for a std::vector<std::string>, and returned it by value. Not RVO, not a pointer, not a reference. I mean:
struct Type
{
std::vector<std::string> member;
std::vector<std::string> GetMember() { return member; }
};


And when I asked him to not do that he got upset. Like buddy, sometimes I'm lazy too. I use a std::string because I'm burned out on a feature and want to be done with it ASAP. I feel dirty when I do it, but I certainly do it all the same.
But then I turn around and see this kind of shit, and it's like. Why did you even become a programmer if you're not even going to give the barest amount of a shit?
>>
>>101993229
Show the version that doesn't use any heap allocations now.
>>
File: queries.png (77 KB, 1258x676)
77 KB
77 KB PNG
>>101993281
>>
File: firefox_beSZdRVp01.png (685 KB, 500x500)
685 KB
685 KB PNG
>>101992750
>>101991608
>>101991474
>>101991396
Are you fucking retarded? There's no mallocs behind the scenes here. cout can write directly to the stdout buffer and convert ints to strings in temporary (stack) memory.
>>
>>101993309
>There's no mallocs behind the scenes here
>>101993074
>>
>>101993309
and yet....
>>101993074
>>
>>101993304
Retard.
>>
>>101993348
Looks like I was right again. ^_^
>>
File: 1721728507285995.jpg (40 KB, 399x462)
40 KB
40 KB JPG
>>101993143
he didn't samefag, you just can't handle criticism.
even when all you're doing is copying the first example out of a tutorial and posting it here for whatever reason.
>>
>>101993355
Why can't you solve your own problem?
Did you just make up a trivial example to show how bad gcc is?
>>
File: OIP.jpg (52 KB, 474x485)
52 KB
52 KB JPG
>>101993333
>>101993334
>gcc
>2024

guys...
>>
>>101993380
You're all mouth breathing retard niggers.
>>
>>101993304
That's not heap analysis. That's a single internal function.
>>
>>101993382
>Why can't you solve your own problem?
The solution is right there, you nincompoop. There are no dynamic memory reservations - in fact they CAN'T be there, because I'm hooking RtlAllocateHeap as well.
>>
>>101993424
You argue like a fucking jew.
>>
>>101993400
>internal
Wrong.
>>
>What are you working on, /g/?
Cloning some boardgame my friend likes in C and SDL. Mostly for shits'n'giggles.
Absolutely nothing exciting about it other than how to handle decentralized asynchronous low-connectivity gameplay. It just means lots of game-states getting passed around, pre-rolling potential random chance events, and ignoring "what if the players interact here?".
>>
>>101993435
Good. Jews are right by might.
>>
>>101993475
Yes I figured that's what you were when you were both wrong and aggressively retarded.
>>
>>101993484
>>101993229
:p
>>
>>101993460
>Caring about your craft = autism
>Worthless semanticalities = not-autism
You know, I've found that people with ASD tend to be generally terrible programmers. Perhaps anon isn't really the one with autism, it's actually you.
>>
>>101993493
Show me a cout with no mallocs.
I'm waiting.
>>
>>101993503
On gcc, specifically, because if I don't specify exactly you will jew out of it again.
>>
>>101993424
>because I'm hooking RtlAllocateHeap as well.
I definitely believe that someone writing babby's first sepples example, complaining that writing to stdout without using malloc/new/new[] is too hard and complicated, is also hooking low level system APIs. That's 100% a thing that's happening.
>>
>>101993503
Sorry, I don't write code in broken languages. But an output routine without mallocs, well, that I've already posted: >>101993304 >>101993424
>>
>>101993538
>literally a dumb rust tranny jew
Why are you idiots like this?
I have no problem with rust except for the fact that you fucking retards are explicitly trying to kill c with it.
>>
>>101993531
>too hard and complicated
I love how you're literally making shit up. Totally shows to our audience that you're not the one who's always wrong.

>for our autistic viewers: I'm actually being ironic
>>
>>101993557
>he doesn't recognize C when he sees it
Nocodeshitter.
>>
>>101993557
I have problems with Rust. Namely that it makes all the same mistakes that C++ makes. It's also just as poorly designed.

All we needed was ocaml with affine types and manual memory management. Instead we got frankenstein's monster that's exhausting to both read and write thanks to the sheer verbosity of the thing. It's a fucking joke.
>>
>>101993570
>I love how you're literally making shit up.
Meanwhile:
>>101991665
>>
>>101993591
>manual memory management
You mean arenas. mreserve and mcommit, right? Because we already have malloc, and it's a travesty.
>>
>>101993591
That's fine those are valid criticisms of a language but that has nothing to do with why cout generates mallocs behind the scenes in gcc.
>>
if I have some function that declares a bunch of variables of various sizes, does the compiler insert padding the same way it would in a struct to keep alignment?

void foo() {
uint32_t var1;
uint16_t arr1[3];
//16 bits of padding here?
uint32_t var2;
}
>>
>>101993613
>non sequitur
OK.
>>
>>101993627
The stack is supposed to be aligned to native word size, so yes.
>>
File: 1717867300869285.gif (3.24 MB, 600x600)
3.24 MB
3.24 MB GIF
>>101993538
>>101993424
>>101993304
>I've already posted
>output routine
>NtQueryEaFile is used to read EA from NTFS file.
Nice "output" routine. You don't even know what the fuck you're posting. You couldn't even be bothered to do a cursory amount of research before posting it.

Jesus fucking christ dude.
>>
>>101993687
>he doesn't understand that _NtQueryEaFile is a random hook that calls the real NtQueryEaFile
>and that the output is everything in the DEFAULT_PROLOGUEX block
I can literally feel my IQ dropping when replying to you, so this is the last (You) (You) get from me.
>>
>>101993627
I was told to list your vars from biggest to smallest so the compiler would put all of your padding at the end and it would be the least amount needed but that's probably wrong and produces extra mallocs behind the scenes in gcc.
>>
>malloc on the stack
Ten years ago this would've been trolling. Now this just what /g/ has degraded to.
>>
>>101993620
I'm the anon who posted the valgrind analysis of cout. I just saw the opportunity for a branching topic. This is a thread for programming in general, after all.

>>101993725
Great, now show me one that isn't exclusively for NTFS metadata.
Better yet, show me proof that the msvc implementation of cout has no usage of malloc/new/new[]
I'll wait.
>>
>>101993837
Do you change your posting style like not using capital letters often?
>>
File: rtl_exit_user_process.png (34 KB, 1020x390)
34 KB
34 KB PNG
>>101993837
>Great, now show me one that isn't exclusively for NTFS metadata.
Whatever.

>show me proof that the msvc implementation of cout has no usage of malloc/new/new[]
That would be a lie.
>>
>>101993899
I still have yet to see this trivial code example >>101991301 rewritten with something besides cout that doesn't produce mallocs.
>>
File: IDA_is_your_friend.png (3 KB, 1028x40)
3 KB
3 KB PNG
>>101993932
If it's console input and output you want specifically: IDA is your friend.
>>
>>101994007
That's a deprecated win32 function.
>>
>>101993899
>That would be a lie.
That's the entire origin point of this conversation.
>>101991301

Correct me if I'm wrong, but your standpoint seems to be:
>The standard does not indicate that cout/cin and associated operations MUST use heap allocations
>Here are examples of io operations that do not make heap allocations
Thus, you're arguing that in theory, the original posted code doesn't necessarily make heap allocations in all cases?
Do I have that right?

Or is the whole thing confused from the very beginning, and there are several arguments happening, almost all of which are out of context? Let's untangle some of this shit here, because I think this might be a slapfight where everybody is talking past each other.
>>
It's a real shame this tranny site lost unique poster counts I wonder why that happened.
>>
File: wrong.png (12 KB, 724x266)
12 KB
12 KB PNG
>>101994061
Wrong, fake, and gay. It's a native API function straight from ntdll.dll.
>>
>>101994106
>and there are several arguments happening
Yes.
>>
>>101994146
Ok rewrite the example using it I want to see how it works.
>>
>>101994146
ntrdll.dll.dll
>>
>>101994175
My rate is $100 per hour. I figure it'll take about two hours to have a satisfactory prototype, so that'll be $200, in advance, please.
>>
>>101994172
Okay, because that hadn't been made explicit on your part. What you're saying is much more agreeable in the context that was lacking, and there is no argument. Thanks for clearing things up, anon. I'm glad we have somebody who's well versed in Microsoft's APIs posting in this thread.
>>
>>101993627
Order and placement of variables is undefined so arr1 can be placed after var2 by the compiler.
>>
>>101994228
>xhe can't
Fair enough.
>>
>>101994255
How else, do you think, did I get regger as fast as it is?
>>
>>101994263
>he can't pay
Guess we know now who's employed and who isn't.
>>
>>101994343
sorry, I only pay for real woman services
>>
>>101994261
Padding isn't defined either. Anon's problem domain already assumes a degree of programmer knowledge of the implementation being used.

But also
>can
may*
I'm not aware of any existing compilers that actually reorder struct fields, for C or C++.
>>
>>101994343
>takes 2 hours to replace cout with some overly complicated win32 specific function just to avoid malloc
You've literally never had a job.
>>
File: ntcreatefile.png (23 KB, 1038x724)
23 KB
23 KB PNG
>>101994372
>takes 2 hours to replace cout with some overly complicated win32 specific function
One: I've already stated:
>It's only useless if you don't know how to repurpose it in future projects. That's what you should learn instead of reading and then printing out numbers.
Two: Wrong again, it's not Win32, it's native API.
Three: Yes, that's an important difference, because Win32 function are actually pretty atrocious userspace wrappers.
Four: I actually didn't have need to write my own console implementation. I DID have need for my own file I/O though: >>101993304
>>
>>101994371
>struct fields
We're talking about auto's here, with structs it's different. Does it matter where on the stack the auto is? No. In structs probably yes.
>>
>>101994487
Oh fair enough. I misread anon's question.
>>
>>101994457
>it's not Win32, it's native API
The NTdll.dll isn't from WINDOWS NT ok.
>>101993899
>>101994457
This code is a nightmare I would never hire you.
>>
>>101994544
>This code is a nightmare
Well, you're always wrong, so that makes sense, too.
>>
>>101994544
Win32 API existed since before Windows NT, RETARD
>>
>>101991301
this was me doing a tutorial from chapter 1 of learncpp.com
I don't know what the fuck you've been arguing about
>>
>>101994594
You're not providing us very good meat to argue over, but we make do.
>>
>>101994544
the win32 (aka windows) api and native api are different apis anon
https://yuval0x92.wordpress.com/2020/03/09/native-api-win32-api/
>>
>>101994591
>>101994631
It's windows specific was my point as in not available anywhere else but windows you pedantic fucks.
>>
>>101994627
kek
>>
>>101994631
>So basically the Native API is the most basic API of windows for user-mode applications. It provides different functions for user-mode applications such as CreateProcess, OpenFile, etc.
Impressive. Completely wrong, of course, but the confidence in which such nonsense is spouted is impressive.
>NtCreateProcess and NtOpenFile/NtCreateFile are the correct names
>>
>>101981378
unreadable-variable-names punchcard mentality DOES NOT make you cool or edgy and your code IS a burden to anybody else who has to read it
>>
>>101981023
https://www.baldurbjarnason.com/2024/the-deskilling-of-web-dev-is-harming-us-all/
i read this article recently, heres the highlight:
>CSS isn’t just a complex language, it’s one of the most advanced graphics, layout, and typesetting languages available in computing.
>HTML and the DOM are two language that interweave to create a complex and dynamic environment that is the foundation of everything we do in web dev and, by proxy, every industry that has adopted parts of the web stack for their own purposes. They are a deep speciality even without adding JavaScript into the mix.
>JavaScript has become a complex language with a number of built-in APIs and language features that rivals that of many other programming languages. That’s despite not having a proper standard library.
>HTTP on its own is a fully fledged field of study as a platform of multiple integrated protocols (1.1, 2, and 3) that have little in common except for their shared idioms. That’s without getting into WebRTC.
>Web server development is yet another field of study with issues that are completely unique and not shared with the other parts of the web stack, except for maybe…
>Service workers, which require a completely different mode of thinking from the rest of front-end development and have more in common with web server programming than DOM manipulation.
>Workers have become a full-featured parallel programming paradigm.
>Testing, irrespective of the language or platform, is yet another complex specialisation we all just pretend doesn’t exist.

it convinced me that webdevs have it harder than cave-dwelling c programmers and that the latter only talk shit on the former because they dont actually know anything
>>
>>101994681
dropping a prefix like that is pretty easily understood anon. if you find that to be nonsense, you should work on your linguistic skills. reads perfectly fine and is entirely understandable to me.
>>
File: capture1-1.png (11 KB, 1013x274)
11 KB
11 KB PNG
>>101994681
>>101994631
Also picrel is utterly deceptive. The reason why CreateFileA is a stub isn't because it refers to NtCreateFile directly, but because MS changed their minds about where they want their functions to reside. CreateFileA used to be in kernel32.dll, but resides in kernelbase.dll these days, where it's a really slow wrapper around the actual native API call, NtCreateFile.
>>
>>101994732
>dropping a prefix like that is pretty easily understood anon
Not if the prefix provides an actual distinction, like in this case.
>CreateFile => Win32
>NtCreateFile => ntdll.dll
Also there's the Zw functions which are equivalent to the Nt functions if called from userspace, but don't perform handle verification if called from kernelspace (like if it's a driver).
>>
>>101994713
>it convinced me that webdevs have it harder than cave-dwelling c programmers
True. C programmers can simply improve their memory usage, webdevs can't and are stuck with their life choices.
>>
>>101994713
C programmers talk shit about webdevs because the march of technological "progress" is going the wrong direction. Instead we should be reverting it to the point where we actually, literally go back to living in caves, and instead of using words, we just scream.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA
AAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>>
>>101991092
What do you like programming in? Just curious
>>
>>101994829
They do the best they can with a language that was written in 11 days and has no standard library.
>>
>>101990885
Passing typedef's around
Lets say I have some types. One of them (Pub) is the more "public facing" type that users would actually use and specify templates arguments for. Another (Sub) is basically a companion piece, but it corresponds to Pub with the same/subset template arguments.
So I typedef Sub in Pub with the correct template parameters
But there is a third type SubBase, which Sub inherits from, and it also needs the type parametrs
This becomes error prone, adding a template parameter can become a problem, it requires extensive changes all along the chain. Adding a parameter pack can be even worse, because it can be empty.
Now, Pub and Sub use the same Rub<T, U>. Since it's fully derived from the template types you don't pass it from Pub to Sub. Now, you introduce RubBase which is base of Rub and the part of Rub Sub uses, then you switch Pub to use Rub2 (also derived from RubBase) now there's a mismatch in Rubs used between Sub and Pub

It is much easier to treat Pub as a collection for the whole templated tree. Instead of passing Pub's template parameters to Sub, simply pass the entire Pub and have Sub re-use the typedefs from it
>>
>>101994852
C and assembly. AVX specifically.
>>
Does C++/gcc have something like a strict constraint requirement? Basically

template<typename T>
concept MyConcept = requires {
typename T::A;
};

template<typename T>
requires MyConcept<T>
class MyClass {
using T::A; // OK
using typename T::B; // error out, not guaranteed by constraint
};
>>
>>101994928
no unless you implement minimal examples yourself
>>
>>101994928
that's reverse O from SOLID
>>
File: bat2.gif (27 KB, 512x512)
27 KB
27 KB GIF
>>101994713
C NEETs prefer C as a tool because they don't have jobs. The speed at which you can design UI and backend services in javascript far exceeds that of C. Freshmen CS students have had it drilled into their heads that runtime performance is the gold standard of efficiency, but the reality is that developer time is the metric most businesses are optimizing for. If you had 2 weeks to get a certain task done, you'd use the tools that allow you to iterate the most quickly with reasonable tradeoffs in runtime efficiency so that you don't blow past your deadline to save yourself 10ms of load time
>>
>>101995461
>developer time is the metric most businesses are optimizing for
Only once though. Then they see the monthly payments for the hardware that their product requires and screamingly wonder why we haven't been able to go higher than 3.5 GHz in the last twenty years.
>true story
>>
>>101995461
electron apps long passed the point of being reasonably bloated though
>>
File: ef_light1.png (39 KB, 768x768)
39 KB
39 KB PNG
how do I implement those gradient light effects that RPG maker games use into my java swing game?
>>
I would like to make a website in which only locations around town or county or state can access it. What do?
>>
>>101995743
Maybe but there are no good alternatives. Basically all native UI frameworks suck balls
>>
>>101995862
you need to use color blending. idk the swing API for it, though
>>
>>101979603
does anyone have a real mode instruction set?
its about the opcodes
>>
nevermind nasm is so good.
>>
>>101994970
What do you mean?
>>
>>101996395
i mean something like
struct MyConcept_Example {
struct A;
};
static_assert(MyConcept<MyConcept_Example>);

typename MyClass<MyConcept_Example>;
>>
>>101994928
no, they're not supposed to be strict in that way, they're supposed to be loose, that's not exactly very useful
constraint resolution does automatically use the strictest/least general possible set of constraints though
>>
>>101979603
inline gcc constraint to get given an aligned stack? (local variables are under rbp, making a second function call and returning the frame pointer is extremely silly)
>>
>>101996516
Yea but the point isn't enforcing a concept (is already is with the requires clause), but rejecting usage of anything that's *not* guaranteed by the concept
>>
>>101997037
The point of generic code and concepts is that you have open types that can be fit in multiple places. If you don't need that, then simply do regular closed types.
>>
>>101997037
yeah if your template tries to do
MyConcept_Example{}.f()
it wont work
>>
File: PXL_20240813_071823827.jpg (2.27 MB, 3024x4032)
2.27 MB
2.27 MB JPG
Should I build a new (third) RISC-V CPU or try to improve the shitty kode from my last one?

Or should I keep the current one and build a compiler for it? I want to build a compiler badly, but i don't really know what kinda language i want
>>
>>101997371
build? as in, physically build? or just writing an emulator for it?
>>
I still can't believe they made views::zip() empty those fucking retards
>>
>>101997635
requires (ranges::view<Views> && ...) && (sizeof...(Views) > 0)

wdym? seems fine to me?
>>
>>101997681
theres another one
>>
>>101997681
>>101997693
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4950.pdf
it doesnt do zip_view for 0 it just does empty
there was even some guy who sent them a paper saying holy fuck this is retarded just add a >0 clause if youre too stupid to see why it should be repeated infinitely
but nope OOP prevailed yet again, everything must be "NULL"
when they finally realise what zip<> should do, they will cry and say they cant heckin change zip() which i guarantee 0 people use
>>
>>101997566
Build as in designing one with a hardware description language. So yes, more or less physical, but not physical.
Looks like software, but is hardware
>>
>>101997731
Also subrange has annoying requirements due to semiregular bullshit, so your iterator needs a meaningless default constructed state
>billions must null
>>
>>101997731
the ranges proposal has been the most controversial shit added to C++ recently I feel like, everybody hates different parts of it for completely different reasons, it probably should have been pushed a few years back. The only bit I found useful is a reverse view to use with for-range loops, nothing else...

>>101997737
and you got a physical version you can run or is it all purely theoretical?
>>
>>101997802
It would be useful if there wasn't a bunch of fucking retarded design and a shit ton of bloat due to muh zero cost
>>
>>101997811
>muh zero cost
If only zero cost wasn't so goddamn expensive.
>>
File: out.webm (2.94 MB, 1280x720)
2.94 MB
2.94 MB WEBM
>>101997802
>and you got a physical version you can run or is it all purely theoretical?
physically running on an FPGA and can display a clock on a LED display. webm kinda related.
The CPU is doing mainly the display and communicating via uart to an arduino which does the timekeeping
>>
>>101997927
really cool shit! last question: how did you get started? I am interested on doing something like this myself in the future as well.
>>
My compiler now supports bitwise operators.

Now we move on to logical operators.
>>
>>101998072
>how did you get started?
university course with an excellent professor.
I don't know how to get started with FPGA shit on your own. There ain't that much documentation and easy start.
Well, it got a little easier with open source toolchains and cheap FPGAs like the tang nano, but it's still not easy since hardware design requires a completely different mindset than software design.
First you gotta understand register-transfer-logic.
Then you gotta internalize that EVERYTHING happens simulatenously inside the chip. Up to this point it can be really frustrating. If you internalize that and know how to harness all of that shit with placing registers everywhere, then it gets fun
>>
>>101998084
based.
Are you emitting """just""" assembly or do you want to generate the machine kode yourself?
>>
>>101998104
Thanks for all the info. Yea, some digging will be needed on my end but there hasn't been anything I wasn't able to do before, this might be an interesting challenge, I might also get started from simpler things like Ben Eater's "build your own CPU" series.

To answer your question regarding what to implement for your chip: Something with the expressiveness of HolyC would be cool (but less schizo), something low level but relatively modern looking would be a good target I think.
>>
>>101998137
I gotta add: Bootstrapping from scratch should also be very interesting, start with a super small seed for your ISA and gradually build up to a full fledged compiler.

Here's an example, but dont cheat!: https://github.com/oriansj/bootstrap-seeds
>>
>>101998119
So far just assembly, but writing my own assembler seems like the logical next step.
>>
>>101998137
>>101998193
Yeah I was thinking, before I reinvent the wheel again and get stuck in CPU design hell, I should move on.
My CPU currently implements the RV32i ISA, which is the very basic integer only instruction set, no mul/div/mod. I should start building a compiler for that, while extending my CPU just a little bit to get some file system with SD-Cards working and then try to build a super simple bootstrapped computer.
If all of that shit works, then I can still extend the CPU to 64 bit and mul/float/whatever.
>I gotta add: Bootstrapping from scratch should also be very interesting, start with a super small seed for your ISA and gradually build up to a full fledged compiler.
Huh, I gotta look into that. Don't even know what is really meant by that.
I thought compiler bootstrapping is just:
1) Write a compiler with one language
2) Write it with the new language
3) Try to compile it with that language
And the extra challenge would be to do all of that on RISC-V (which would need keyboard IO and filesystem)
>>
whats are some desseration level ideas in CompSci which I create a project on?
>>
>>101999533
If you have to ask that question, then you are doing something wrong
>>
File: decimal_writer.png (10 KB, 800x270)
10 KB
10 KB PNG
>>101999533
Why modern CPU features, despite looking good on paper, are hampered by both compiler and operating system builders.
>why compilers
Because compilers lack the pattern recognition necessary to determine if vector instructions help with a particular use case, and if bundling malloc instructions into a pool with larger page sizes would help. And when I say "pattern recognition" I mean simple stuff like "this field will never exceed 32 bytes, so two vmovdqu would be totally enough for a proper copy, but can the compiler know that?" or "I need to print a 64-bit decimal value, but is the compiler smart enough to perform a PBCD conversion in two GPRs (because PBCD still gets rid of 6 of 16 characters in the alphabet) to then upload them into the XMM domain?" My experience shows that they don't, and that compilers require extensive handholding.
>why OS builders
Because kernel developers still haven't arrived in the 64-bit era, still don't know how to make use of virtual address space in the kernel, are still deathly afraid of swaps to mass storage, and thus don't treat pages with bigger sizes the same as their much smaller counterparts. No system here is perfect: Linux requires a set of such pages to be pre-allocated before the actual call by mmap (transparent huge pages are cancer because they require madvise after the alignment has already been set, which, more often than not, are 4-KiB-aligned; if THPs had had any chance at all it would've had to occur during mmap), on Windows you have to fiddle with privileges, and the allocation can still just randomly fail.
>>
How do I write a stream-based json parser (or any parser)?
Like if you get some json, surely you’d need to know all of it to be able to determine if it’s valid etc?
>>
>>101999879
Oh, and also with regards to OS builders:
>because stock kernels and userspace libraries are usually compiled with non-VEX-prefixed SSE instructions, which are absolutely killing the performance of VEX-prefixed instructions (both for 128 and 256 bits: https://www.agner.org/optimize/optimizing_assembly.pdf, page 106, "13.2 Mixing VEX and SSE code"). Every time you do a stock memcpy you best perform a vzeroupper, just in case a single SSE instruction placed you into a unfavorable state. What's that? You need the data in the upper YMM registers? Well, sucks to be you then, because the OS builders are a bunch of lazy furry faggots who just declared all upper YMM portions volatile, just so that the vzeroupper scam continues to work.

The best you can do is to unironically install Gentoo.
>>
>>101999923
Same way you do HTTP parsing:
>whenever a new chunk of data comes in you check how much further you can get this time
Does that require state to be preserved between checks? No, but it would certainly speed up things.
>>
>>101980847
i cant read the clojure code
how do i accept being a dimwit
>>
>>102001223
By asking them how many malloc calls are being done behind the scenes.
>>
>>101999879
not just compiler and OS
firmware too
i'm not sure when they properly set up things like above 4 gigabyte address decoding but a lot of firmware forces processors into only being able to decode 32 bit addresses even when the hardware supports more
i've been on-off looking into ACPI hacking to force my haswell to use all 39 bits of physical address space/48 virtual but patching the DSDT tables even at runtime scares the fuck out of me and my mobo's firmware binaries appear to unironically be full of errors anyways
>>
>>101986222
fixed it; fyi if anyone cares:
altivec has a shift octet instruction (vec_slo, vec_sro), but it's not equivalent to an sse2 byte shift (_mm_bslli_epi128, _mm_bsrli_epi128). it only shifts each value individually (very anti-risc to have a dedicated instruction for this). i had to shift double (vec_sld, vec_srd) with a zero'd register.
>>
>>101999879
>Why modern CPU features, despite looking good on paper, are hampered by both compiler and operating system builders.
Because making a compiler and an operating system fully using modern features require rewrites that involve changing the mental model of how a CPU works and involving concurrency more.
And the user doesn't want vector swizzling, they want to use a 20 year old program to load cat photos.
>>
>>102001938
The users are wrong, the programmers are wrong
What's left?
>>
>>102001938
>And the user doesn't want vector swizzling, they want to use a 20 year old program to load cat photos.
any image library, even 20 years ago, will be vectorized out the whazoo
why do you think windows on arm is so much less performant than on x86? same reason
>>
>>101980667
>Exceptions, Delegates, Events, Lambdas, Files
>Advanced Features
>>
I want to try to build my own language from scratch (without LLVM). Should I do it anons?
>>
>>102001223
It's just a lisp innit?
>>
>>102002584
Same. Doing this rn. Have a lexer already handwritten.
>>
>>102002802 (me)
And started an RD parser for an AST too.
>>
>>102002802
>>102002839
I (anon you replied to) have already tried to make an interpreter for a simple language a couple of years ago, but gave up when I had to implement functions and garbage collecting. Should I make all functions basically anonymous or should I just store them in memory as values?
>>
>>101999879
this fucking retard really doesn't leave the thread does he
>>
>>102002876
Why should functions be difficult? But to be fair i haven't reached that phase yet.
And gc i don't do, it's a C-like low level language so far.
>>
Im playing Factorio and working on Automate the Boring Stuff with Python.
Im taking it slow, Anons.
>>
I know too little to set goals outside of passing community college classes
>>
Im still too pea brained to "code" cleanly instead of scripting spaghetti
>>
that one asshole Anon who said "if you find Python daunting then STEM is not for you" had never met anyone in STEM
>>
File: 1685264130533821.jpg (136 KB, 720x960)
136 KB
136 KB JPG
>>102001938
>Because making a compiler and an operating system fully using modern features require rewrites that involve changing the mental model of how a CPU works and involving concurrency more.
Wrong. The vector tasks that I have in mind, that I have specifically posted about (memcpy, decimal/hexadecimal <=> ASCII conversion, UTF-16 <=> ASCII conversion, ASCII etc) have little to do with concurrency except with the usual out-of-order execution nonsense modern CPUs have to do. They're also happening a disgusting amount of times, especially in high-level languages that - surprise, surprise - don't make use of virtual address space either.
>b-but muh systems without virtual address translations
I've already stated months ago that for these systems mreserve can be a no-op. Instead we're still working with the same tools as thirty years ago, just with longer pointers this time.

>And the user doesn't want vector swizzling
The user wants his hardware to do the things that the ads told him about, and the fact that Intel still somehow makes money off of poor retards shows that single-core instructions per clock performance is still important. Vector swizzling is exactly what users wish their 20 year old program loading cat photos was capable off because they paid for that CPU and they hate to wait.

>>102002901
Seeing you seethe powerlessly is one of my raisons d'etre.
>>
>>102004182
Your raisons d'etre is pretending you're intelligent for being a tinkertranny
>>
>have vacation and dont have to kode at cagie for 3 weeks
>put alarm to 7am to start koding
feels good
>>
File: 1683032501144574.jpg (99 KB, 1024x768)
99 KB
99 KB JPG
>>102002381
There's a whole lot of programmers who still don't understand that there's no magical water that library devs are cooking with. When they call memcpy they'll assume that this is the fastest way to copy things around that there is - fuck, I was guilty of the same thing until I started learning assembly and dug through all sorts of library code. memcpy can be slow because:
>checking for special values or alignments at runtime messes with branch prediction, but not checking for them can be even slower (at a certain threshold rep movsb's initial overhead is dwarfed by instruction decoding and cache eviction overhead)
>calls and far jump and internal redirections mess with the instruction cache much worse than some small-value-memcpy ever could if it was inlined
>code can have undesirable side effects, like the aforementioned state switch due to non-VEX-prefixed SSE instructions

>inb4 but programmers aren't supposed to know these things
Debatable, but let's assume for a moment that you're right ... then who is? The compiler? I highly doubt the compiler would produce garbage like >>101984741. PCSX2 used to ship with GS cores for specific instruction sets (SSE 4 or AVX2), the notion that the emulator has no need to make use of vectors is ridiculous, and on top of that my analysis came from a nightly build this month. What was their modern compiler doing? Probably the best it could without hints.

As to why it's debatable ... GCC allows devs to assign a probability for any given branch (__builtin_expect_with_probability), because without any such hints it's really difficult to make these sorts of predictions. What the hint does? It keeps the likely code path with as little taken jumps as possible. Jumps are assumed to be not-taken by the branch predictor, and the fewer jumps there are in the code path the faster it is. It all boils down to the programmer being unable to provide hints for the compiler, and there's just so many of them.
>>
>>102004462
micro-optimizations like vectorization and branch prediction hints have a mimimal performance impact on most real-world programs
>>
File: magic.png (26 KB, 1090x950)
26 KB
26 KB PNG
>>102004480
And yet my hard-coded AVX splitter only took 8 seconds to shove even and odd bytes into their respective output files, and the naive byte-wise splitter took 30. Same section bullshittery, by the way, which also took the most time to implement correctly because MS is garbage - the AVX-specific stuff was done in an hour.
>>
File: 1714852888570302.jpg (277 KB, 1600x1000)
277 KB
277 KB JPG
>>102004480
>vectorization
not a micro-optimization
>on most real-world
we're talking about an emulator being used to play games
>>
>>102004528
>shove even and odd bytes into their respective output files
Did you miss the part where I said "real world programs"
>>
File: final_version.png (35 KB, 1530x968)
35 KB
35 KB PNG
>>102004557
What about real-world programs? You mean the one I've been challenging people to beat me on for seven months now? Or do you mean PCSX2?
>>
>>102004553
Vectorization can be a micro optimization or a macro optimization I guess
For a game console emulator, unlikely to have a significant performance benefit, games don't tend to be structured that way
Unless you're doing software rendering or something
>>
>>102004565
PCSX2 would be a real-world program, not whatever you're doing
>>
>>102004584
>For a game console emulator, unlikely to have a significant performance benefit
So unlike you I've actually trapped calls to memcpy and know what the emulator is doing, so unless you've done similar work and have the data to contradict me I'd suggest that you keep your unsubstantiated opinions to yourself.

And aside from PCSX2 and my regger: >>102004182
>memcpy, decimal/hexadecimal <=> ASCII conversion, UTF-16 <=> ASCII conversion
And those are the use cases I've actually worked on. In seven more months I'll probably have even more.
>>
>>102004641
the overall cost of memcpy is utterly insigificant compared to everything else it's doing
Vectorization could have significant performance benefits for renderering, but you're better off doing that on the GPU
Your programs are very simple, they are not real-world programs
>>
>>102004596
>not whatever you're doing
_Highly_ debatable, but sure, let's go that route: >>102004641
I can't wait to see your data that would suggest proper vectorization wouldn't help at all in PCSX2.
>>
>>102004657
>the overall cost of memcpy is utterly insigificant compared to everything else it's doing
Which is?
>inb4 some vague, undefined nonsensical answer about "emulating a game"
You either analyze the emulator's code right now and tell me there's nothing vectorization can help out with, or you shut your whore mouth until you do.
>>
>>102004684
Vectorization is a specific optimization that only applies to a specific type of code, as you know, array operations
These are not that common in old games, it's more common now because games are programmed specifically to take advantage of this but we're talking about the PS2
The rendering pipeline obviously benefits from this but that's far better off on the GPU
>>
Oh, and also:
>Your programs are very simple
The splitter? Yeah, sure, I'll give you that, I hacked that one together in a couple hours.
The regger? Then why has absolutely no one come forward with their own version in seven fucking months, just to shut my own whore mouth? I'll tell you why: because it's NOT that simple.
>>
>>102004712
>no data
Didn't read, come back once you left your ivory tower and have some actual data.
>>
>>102004720
I'm not subscribed to your fucking blog I don't know what programs you're writing
>>
>>102004728
What can be asserted without evidence can be dismissed without evidence
>>
>>102004528
>>102004565
>>102004596
>>102004641
>>102004657
>>102004662
>>102004712
>>102004720
You guys know that RV32V extension is ratified now? No need to use that grandpa x86 shit anymore. Imagine using some cringe architecture with a cringe vector extension. Cringe desu
>>
>>102004729
Sounds like a (you) problem, unless you're agreeing to an attempt to beat me in regger in whatever programming language of your choice.
>>
>>102004747
What's a regger?
>>
>>102004750
a regular german
>>
File: PXL_20240821_061515335.jpg (2.4 MB, 4032x3024)
2.4 MB
2.4 MB JPG
That's the task for today. #VacationVibes
>>
File: memcpy.png (11 KB, 460x778)
11 KB
11 KB PNG
>>102004736
I accept your surrender.
>>
>>102004786
Neither of us have any evidence here, I'm simply speaking from experience
>>
>>102004786
That algorithm runs in O(n) time. I can tell you that.
>>
File: format.png (148 KB, 1894x966)
148 KB
148 KB PNG
>>102004750
A registry dumper, and a pretty fast one at that. Output format is UTF-8, file size should be around 400 MiB or higher, and the keys need to be sorted alphabetically so that diff produces comparable output.
>>
>>102004802
A registry dumper is a trivial program
>>
File: 1639939482736.png (444 KB, 2752x4342)
444 KB
444 KB PNG
>>102004796
I know. That's the default memcpy/memmove on Windows that PCSX2 calls all the fucking time, even for minuscule amounts of memory.

>>102004795
Your experience is worthless, code is all that matters.
>>
File: 1662384321592561.jpg (143 KB, 1024x1020)
143 KB
143 KB JPG
>>102004809
Please go ahead and write your own version then. I could really do with some competition - being on the top is boring.
>>
>>102004813
You posting random snippets of code is not evidence
Most programs call memcpy all the time, but the performance impact of doing so is minimal compared to the other stuff it's doing
>>
>>102004844
>You posting random snippets of code is not evidence
Where's your counter-evidence to that?
>>
>>102004836
I've got much better things to do than that bro, you're at the top of a very small mountain
>>
>>102004813
>I know. That's the default memcpy/memmove on Windows that PCSX2 calls all the fucking time, even for minuscule amounts of memory.
You might be right here, but games are for children
>>
>>102004857
>I've got much better things to do than that bro
Translation: *running away with tail between your legs*.

Thought so.

>>102004858
And?
>>
>>102004878
No real programmer is going to spend time making a Windows registry dumper, try working on a real project
>>
File: non_default.png (44 KB, 1000x940)
44 KB
44 KB PNG
>>102004883
>No real programmer is going to spend time making a Windows registry dumper
Wrong, but then again you strike me as the type of guy who doesn't like money anyway.
>>
>>102004878
>And?
Nothing. I am just pointing that out. Real men write Javascript and React
>>
>>102004901
Yeah I'm sure Bill Gates handed you a check for a million dollars for this amazing piece of software
>>
>>102004912
Not Bill Gates directly, but man, did it come in handy.
>>
>>102004912
imagine having such rustled jimmies. Sheesh bro
>>
>>102004930
Are you going to pretend you're employed now
>>
>>102004940
Are you going to pretend I'm not?
>>
>>102004947
Considering you spend all day shitposting in this thread about these simple programs you're writing I think we all know what the truth is
>>
>>102004959
>all day
>doesn't notice my huge gaps of non-activity ITTs
You are not qualified to consider anything, least of all other people's actions.
>>
>>102004975
If you were employed you also wouldn't feel the psychological need to brag about trivial accomplishments
>>
>>102004988
>psychological need
Wrong. It's Pascal's Wager plain and simple:
>I can feel good about myself dunking on people with inflated egos
>or I can be actually corrected by them and learn something knew
I literally cannot lose.
>>
>>102005006
People with jobs don't feel good bragging anonymously online about their hobby programs because they have real programs in real life that they make which they actually get paid for so the former feels absolutely trivial in comparison
>>
>>102005027
No, most other programmers are ashamed by the code they produce and can't brag about it even if they wanted to. Me, well, I'm just that good that I can do what others wish they could: >>102004813
>>
>>102005054
Your projects are what high schoolers do
>>
>>102005062
Why don't you post some of their works? Or would that destroy your credibility completely
>>
>>102005078
I don't actually know any high schoolers
>>
>>102005084
I accept your concession.
Yet again.
>>
>>102005097
When I was in high school I was doing things like programming 3D and networked games
You are printing a file
>>
File: PXL_20240813_072454505~2.jpg (1014 KB, 3024x1934)
1014 KB
1014 KB JPG
>>102005119
When you are so fucking smart, then why can't you solve this simple task? Pic related
>>
>>102005119
And yet you didn't post a single line of code. Tells me you're incredibly ashamed of your work, if it even exists.
>>
Finished my own PHP template engine. It's a pretty simple thing but I think it's still neat.
>>
>>102005149
Why would I post a single line of code
>>
>>102005181
Because your credibility has just been destroyed completely: >>102005078
>>
>>102005194
You seem to be having an argument with an imaginary person in your head, I don't have any credibility to maintain
>>
Boys, I am not streaming rn. Stream will be delayed because I just got my period
>>
>>102005203
>I don't have any credibility to maintain
Another surrender I'll gladly accept.
>>
>>102005210
I'm sure the imaginary person you're arguing with feels very offended by this
>>
>>102005219
I'm sure of it. After all he's desperately trying to convince me it's not (You).
>>
>>102004584
>>For a game console emulator, unlikely to have a significant performance benefit, games don't tend to be structured that way
not that i actually do any real emulation dev but i've been kind of looking into this because i have a very stupid vaguely related idea for a thing that involves a scalar VM that runs on the GPU
some anon mentioned apparently before that that lolcow byuu killed himself (apparently he was big in emulation? all i know is that one time he spammed every board with pokemon smut) he was working on generic whole device emulation techniques that use the GPU
apparently something about the lack of host interference with scheduling + being able to treat each warp as a discrete device component or something provides genuine actual benefits for emulators looking to get cycle accuracy
i am not sure how much i believe that part because i know for a fact scheduling can get kinda stupid

then there's stuff like dolphin ubershaders which if i read their article right, i think are GPU driven emulation of fixed function hardware on general compute

and i thought the playstation emulators only benefited from vector instructions because at this point they've basically got complete instruction coverage of their weird geometry coprocessors
>>
>>102005346
>apparently he was big in emulation?
Oh yes: https://arstechnica.com/gaming/2011/08/accuracy-takes-power-one-mans-3ghz-quest-to-build-a-perfect-snes-emulator/
>>
>>102005346
GPUs are a poor choice to emulate the behaviour of general-purpose CPUs
GPUs can be good at emulating rendering or special functionality consoles may have
>>
I'm sorry if this is a retarded question, but instead of trying to develop increasingly sophisticated means of detecting cheats, why don't online games just inject false information to aid detection? e.g. in a game like counter strike where players can't see each other always, why can't the server determine times when it'd be impossible for players to see each other and in those situations display players of each team in random locations like the opposite side of the map, holding different angles, or inject fake vectors for player positions to the client side to mess with aimbots. not only would it work to weaken the advantage of cheats and make the cheating more obvious for player, it could help in detecting the cheaters based on using false information.
>>
>>102005439
Putting bait in games to detect cheats is extremely common
It sounds like you're thinking about detecting cheaters based on humans actually observing their behaviour, which is inferior to a program actually catching them
>>
>>102005381
>GPUs are a poor choice to emulate the behaviour of general-purpose CPUs
poor choice, yes, especially if you're just slapping a CPU emulator on a GPU and not designing a special purpose runtime for it
especially if you're doing from the perspective of high level graphics APIs and shading languages that don't expose any of the hardware features you need in a way you need
but i don't think you understand how ridiculously powerful modern GPUs are
you have thousands of gigaflops of compute power literally just sitting there
for all intents and purposes doing basically fuck all

conceptually it's very very similar idea to why NVIDIA's forcing DLSS into fucking everything, those tensor cores just sit on the die doing nothing during gaming workloads
>>
>>102005530
GPUs have poor single thread performance
You can't take a serial task and just spread it out over all the GPU cores
>>
New thread
>>102005977
>>102005977
>>102005977
>>
File: article.png (41 KB, 760x132)
41 KB
41 KB PNG
>>102005548
>You can't take a serial task and just spread it out over all the GPU cores
yes, i'm well aware, hence
>>102005346
>very stupid
>but it's shit
and that doesn't matter, you literally aren't using it for anything else, unlike RAM unused compute is wasted compute

even if it's as stupid as live training predictive AIs just to avoid doing something (which is something that's come up in current graphics research), the idea is to find something the GPU can help with
based on the ars technica article >>102005376 even though it doesn't mention the gpu shit byuu was probably looking into advanced sync features and gpu driven software based scheduling
vulkan didn't even have the kind of features you'd need for that level of granular control until very recently (subgroups didn't even work properly), it'd have to either be CUDA or even PTX
>>
>>102006038
Actually I wonder how higan would've fared with futexes and spinlocks.
>>
>>102006038
There's not really anything the GPU can help with when it comes to emulating the behaviour of a entirely serial processor
The article is some autistic guy just using the GPU to bypass OS scheduling to get "perfect" emulation where it doesn't really matter at all, which incredibly hacky and not actually using the power of the GPU
The idea that you should just use the computer's resources to do trivial shit because why not doesn't really hold up when you consider your computer is running multiple applications at the same time and they're competing for resources
>>
>>102006138
>using the GPU to bypass OS scheduling
Which article did you read?
>>
>>102006174
>>102005346
>>102005376
>>
>>102006214
Where does it mention using the GPU to bypass OS scheduling?
>>
>>102006254
he mentioned it in the post
>>
>>102006261
You literally said:
>The article is some autistic guy just using the GPU to bypass OS scheduling
Nothing about a post. "Article".
>>
>>102006280
The person mentioned in the post is the same guy in the article I assume
>>
>>102006297
>I assume
That's the problem.
>>
>>102006306
If you think the guy who made the post is wrong, take it up with him, don't sperg out at me
>>
>>102006322
So you admit you didn't read anything, yet decided to have an opinion anyway? This board is turning absolute garbage.
>>
>>102006138
>There's not really anything the GPU can help with when it comes to emulating the behaviour of a entirely serial processor
to be fair i've only thought about this for my usecase where i'd have total control over the hypothetical processor in question but i can think of techniques that might work for general cases
extremely preemptive branch prediction using an additional warp per branch for example

>>102006280
based on
>the foreknowledge the dead furfag was working on something GPU related
>and the content of that quote
>how how that would map to GPUs
it's pretty obvious that's what he was trying to do, at least partially
>>
>>102006437
I read the post and the article
I'm assuming these are the same person and there's not two autists trying to do super accurate SNES emulation
>>
>>102006440
>how how that would map to GPUs
Well, how WOULD that map?
>>
>>102001223
which part are you stuck on?
Have you tried looking up the function/macro names in the reference documentation?
>>
>>102006464
very easily? a GPU is literally just a multithreaded SIMD processor anon

two ways off the top of my head, set aside a warp to act as a granular scheduler for a block of vector threads per warp
wastes a gpu core

on NVIDIA hardware figure out how their cooperative groups API works under the hood
on AMD hardware bypass compute APIs and use driver helpers/the driver directly to set up a way to properly access the cooperative synchronization instructions since AMD currently only exposes easy access to the most retarded one and not to hardware semaphores
>>
>>102006627
*for a block of warps the size of vector threads per warp
>>
>>102006627
>on NVIDIA hardware figure out how their cooperative groups API works under the hood
You do that.



[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.