@@swordoman2158 I believe fe80 would be valid too as that's a link-local address, like having 192.168.1.20 in your bar. It just has to be a valid address, not an useful one
@@stefanalecu9532 You're almost right. In IPv6, link-local addresses are configured automatically with a special algorithm that uses interface's MAC address. There are also "unique local addresses" in IPv6 that can be anything you want and they have the fd00 prefix. The only difference between them I know is that unique local addresses can be routed
Very nice! Next steps could be to use a multi-threaded async approach to get the best of both worlds, also (you already mentioned it) putting the thread/task to sleep instead of spinning. Also why that hate on Rust? I know you appreciate simplicity but the tooling and expressiveness are unmatched imo. Again very nice video! Hope to see more of these! Thank you.
I miss the good ol' days of BASIC where you could just add a line at the top like `on error goto 935` and put your error handling code there. Not to mention the chat comments as caption data, which I hope maybe I was just too early. Also, I prefer wood blocks and hash tables rather than two lists. I'm not sure why you'd avoid a hash map, but if the implementation in C3 sucks then why not write your own. Perhaps worth mentioning, what I came up with in my own language with regards to inheritance and structs is that you could just place the typename for another structured object within your own struct, and it'll include it right there, sort of like anonymous structs in C, except that you can predefine it. For instance: struct Foo { ... }; ... struct Bar { Foo; ... }; The advantage being that you can place the inner struct anywhere within that you want. That said, can you use interfaces in C3 to do similar inheritance shenanigans?
He mentioned several times that the list swapping doesn't change anything about the lifetime management compared to hashmap or other data structures. As for inheritance and gotos... Keep cookin', buddy - just don't mix your soup with mine ;)
@@eliashaider6857 Yeah, my concern wasn't about lifetime management but speed and memory use. Two lists would likely use as much memory, if that's even a concern for anyone these days and would scale horribly in terms of speed as more connections were made.
Hi Mr Tsoding, I see you always code with no autocomplete&lsp, which is a big shock for me. I've used vim and the likes for a long time, and getting autocomplete to work has always been a top priority, before even starting to work on a project. However, it seems there is some merit to not using it. Can you give some tips on how to try, and why you're doing it. To an LSP fan, it seems both liberating, and relying too much on the external documentation.
LSPs are distracting, not using one makes you focus on your code more - that's the whole merit. you can have dumb autocomplete without language servers, though it won't be useful most of the time. if you wanna try going old-school and ditching everything besides syntax highlighting, then just go for - it will be tough at first, but the more you do it, the less you will be reliant on external tooling when writing code. i can't say whether it will make you more productive, but changing your habits is at least a good exercise for brain flexibility
Your `client_async_write_everything` doesn't write everything, it just tries to write a bit, modifies `client.i` as if to resume, but since you do that only once, that does nothing, you need a nested `fut::forever` to drain the buffer before reading more
Why tho? What's the point of knowing always the errors in your code so you can fix them, if the compiler will just tell you those errors at compiled time? Lol
@@waxlbloh6450 While RAM is some concern, the bigger concern is the threads themselves. The CPU can only have a little true parallelism, on a PI that is 4 threads. As Tsoding mentioned in the video, you want to handle many clients, so the hardware is not enough for this, the OS needs to handle that. This is called scheduling. The expensive part here is switching between threads, a context switch is very heavy, which is why calling syscalls should not be done too often. Keeping everything in one threads minimizes the number of context switches, especially when you don't actually need the CPU (as Tsoding also mentions, the server does not do any work, it barely needs CPU time, so why pay for the context switch)
Once you have futures you can have a thread pool or additional processes to poll them on all CPU cores. This is just the first step. Thousands of threads is never good though.
new intro format is dope btw
5:37 "This is not Rust, this is actually a good language"
How could he do this to me 😭
@@RustIsWinning womp womp
i have laughed a lot
“If you want to have some things, you have to develop them yourself, like a real programmer” - zozin
It could be funny to change the ipv6 address in the bottom to "fe80::dead:beef:cafe:6969", it's a valid address. and nice easter egg.
It'd be valid with the fd00:: prefix but yeah
@@swordoman2158 fe80 is a valid prefix
@@swordoman2158 fe80 is a valid prefix
@@swordoman2158 I believe fe80 would be valid too as that's a link-local address, like having 192.168.1.20 in your bar. It just has to be a valid address, not an useful one
@@stefanalecu9532 You're almost right. In IPv6, link-local addresses are configured automatically with a special algorithm that uses interface's MAC address. There are also "unique local addresses" in IPv6 that can be anything you want and they have the fd00 prefix. The only difference between them I know is that unique local addresses can be routed
Good stream, I'd love to see epoll or iouring implemented. That cpu core doing a lot of nothing bugs me out.
On my todo list :)
@1:38:00
"Streamed Offline" glorious humour
То чувство когда русский прогер слушает русского прогера на английском. Но твой английский единственный который я выкупаю без субтитров❤
Иногда и забываю, что он на аглицком говорит, мысли-то очень родные.
Another master class by Mr Azozin
Twitch chat gone for once and Mr Azozin is hyper focused and doesn't even meme around once
c3fut stands for c3futanari in my head
a man of culture
Hell yea
love the "2 hours earlier" clip you've been doing
Very nice! Next steps could be to use a multi-threaded async approach to get the best of both worlds, also (you already mentioned it) putting the thread/task to sleep instead of spinning. Also why that hate on Rust? I know you appreciate simplicity but the tooling and expressiveness are unmatched imo. Again very nice video! Hope to see more of these! Thank you.
Tsodin thinking about how to design the future ...
Talk about where this channel has elevated to ...
Really cool to learn how the async thing really work
Thanks for final motivation to learn C++ coroutines by implementing similar simple async echo server
I miss the good ol' days of BASIC where you could just add a line at the top like `on error goto 935` and put your error handling code there. Not to mention the chat comments as caption data, which I hope maybe I was just too early. Also, I prefer wood blocks and hash tables rather than two lists. I'm not sure why you'd avoid a hash map, but if the implementation in C3 sucks then why not write your own.
Perhaps worth mentioning, what I came up with in my own language with regards to inheritance and structs is that you could just place the typename for another structured object within your own struct, and it'll include it right there, sort of like anonymous structs in C, except that you can predefine it. For instance: struct Foo { ... }; ... struct Bar { Foo; ... }; The advantage being that you can place the inner struct anywhere within that you want.
That said, can you use interfaces in C3 to do similar inheritance shenanigans?
He mentioned several times that the list swapping doesn't change anything about the lifetime management compared to hashmap or other data structures.
As for inheritance and gotos... Keep cookin', buddy - just don't mix your soup with mine ;)
@@eliashaider6857 Yeah, my concern wasn't about lifetime management but speed and memory use. Two lists would likely use as much memory, if that's even a concern for anyone these days and would scale horribly in terms of speed as more connections were made.
@@anon_y_mousseinheritance… speed… seems about right
@@luvzware What are you talking about?
Have you ever considered switching to a dynamic window manager?
I spend 3 hours debugging the Future and in the end I was just missing a different lifetime ...
this sounds like my real life
The tcp listen queue (backlog) is not specific to async, btw
Would also love to learn about what is actor model, channels, and more related to async.❤
5:27 "Like in Rust, but this is not Rust, this is actually good programming language" 🤣🤣
tutorial on how to lose weight pls
Move more, eat less. 🥲
@@ryzh6544hydrate with water
@@ryzh6544 > Move more, eat less.
no. Learn about the insulin response.
@@y00t00b3r ok, so the other way is to get addicted to drugs
@@y00t00b3r can your mRNA dooo thaaat?!
Looks like we're dead :(
Hi Mr Tsoding,
I see you always code with no autocomplete&lsp, which is a big shock for me. I've used vim and the likes for a long time, and getting autocomplete to work has always been a top priority, before even starting to work on a project. However, it seems there is some merit to not using it. Can you give some tips on how to try, and why you're doing it. To an LSP fan, it seems both liberating, and relying too much on the external documentation.
ctags or cscope & key combos.
It mostly comes down to knowing the libraries you're working with and typing properly (I suck specially at long function names)
LSPs are distracting, not using one makes you focus on your code more - that's the whole merit. you can have dumb autocomplete without language servers, though it won't be useful most of the time.
if you wanna try going old-school and ditching everything besides syntax highlighting, then just go for - it will be tough at first, but the more you do it, the less you will be reliant on external tooling when writing code. i can't say whether it will make you more productive, but changing your habits is at least a good exercise for brain flexibility
Was this the one where Jon raided the stream?
idk but I was there CHROOTing alone
i lose track of time looking at this
c3 looks nice
How does our program know that the task is completed? Does it use a different thread for it internally?
If i understand you well you mean the server? Servers are meant to run forever unless you stop it manually or it crashes.
New lang called C3? But I haven't learned Rust and Zig yet. :D
Your `client_async_write_everything` doesn't write everything, it just tries to write a bit, modifies `client.i` as if to resume, but since you do that only once, that does nothing, you need a nested `fut::forever` to drain the buffer before reading more
c3fut is basically tokio for C3
Why not using a threadpool and having the best of both worlds? Maybe something like tbb.
Please do more of the Olive.c episodes
Thank you!
It's called cooperative multitasking
o7 Tsoding caved to using the project.json
Now this video is cool
Any are you ok ? are you okay any ?
Ok, you've become a C3 addict.😅
no "Look's like we're live"? unwatchable
it's not a vod, he just recorded this vid by himself
@@wheezardit's not serious, he just made a joke
Lets go!
Great ❤❤❤
bro i'm a fake programmer. litearlly not gonna make it at this rate
Why not use an actual IDE or editor instead of having to compile your code every so often to check for stuff like syntax errors?
I think there is no powerful editor or IDE tgan emacs. He just didn't configure LSP.
It's called compiler driven development
Why tho? What's the point of knowing always the errors in your code so you can fix them, if the compiler will just tell you those errors at compiled time? Lol
@@lolcat69 Fixing silly semicolon and typo errors the moment they happen and not having to fix 100s of them at once. You know, saving time?
Because real programmers do it this way...
build system with json, yikes
zozin pog
wouldn't it be more appropriate to title this "Processes vs Multithreading"?
No. He is developing futures which are even more lightweight than OS threads. Processes are threads with their own memory space.
@@Israel220500 huh.. how is it implemented then? i guess i should watch the full stream to find out
@@pagenotfound_code_404Single threaded event loop, like in JavaScript
"the borrow checker would have solved that, am i right" good one, but it would also make the video 10h and burned your laptop in the process xd
why would you want to not create threads you poor cpu works so hard to extract some paralellism from your code why do you make its life harder
my 4 core raspberry pi02 with 512 mb ram begs for forgiveness
@RudyRdx what ram does a thread even use other than a lazily allocated stack
@@waxlbloh6450 While RAM is some concern, the bigger concern is the threads themselves. The CPU can only have a little true parallelism, on a PI that is 4 threads. As Tsoding mentioned in the video, you want to handle many clients, so the hardware is not enough for this, the OS needs to handle that. This is called scheduling. The expensive part here is switching between threads, a context switch is very heavy, which is why calling syscalls should not be done too often. Keeping everything in one threads minimizes the number of context switches, especially when you don't actually need the CPU (as Tsoding also mentions, the server does not do any work, it barely needs CPU time, so why pay for the context switch)
Once you have futures you can have a thread pool or additional processes to poll them on all CPU cores. This is just the first step. Thousands of threads is never good though.
How many pure hardware threads do you think you can pull from your CPU?? Think about that...