You should not use sprintf with user- provided data. Use snprintf Sprintf and snprintf functions already add null terminator. The length of formatted string should be found not by strlen(), but by using the return value of sprintf
@@alexeydmitrievich5970 For sure I need to up the security 🙂 but the reason I don't use snprintf it's because it's not available in ANSI C. I use that version of C because of simplicity th-cam.com/video/443UNeGrFoM/w-d-xo.htmlsi=4bWn3YqXHqFtnbOb
I did! The main reason was to optimize for memory locality and reduce the number of instructions sent to the CPU. Given that the dataset in this case remains relatively small, this approach provides better performance. If the dataset were expected to grow significantly larger, I would have opted for a traditional hash table for better scalability. This kind of low-level control is the sort of freedom you lose in higher-level languages.
Yes, I would like that. I am thinking, though, about what would be a good method. 🤔 Maybe I could invite someone with no previous experience in C to walk through the project with me. They could ask any questions they have, giving me fresh eyes on the project.
@dev.roysalazar that someone could be me since I know c but didn't developed any projects but I am currently doing my Masters so we have to talk about time. Also I am a python dev and I also always wonder how these things worked inside the hood. It would be really great If you gave us a walk through, also can we connect on socials?
For now all I can say is that my web server implementation requires fewer CPU instructions for handling requests compared to using something like Node.js, simply because it doesn't rely on the same number of levels of abstraction to perform the "same" task. But, my intention is for sure to eventually make it Blazingly fast! 🚀
The thing is that you created a great project, but you skipped a lot of things and assumed many things from your viewers such as knowing async architecture's implementation, why arenas are useful for memory management, and some linux sys calls, fork(). It would be really great if you you dive deep into these things in a bit more detail so it allows us to understand the underlying workings.
I tried to make the video so that any software developer can grasp the basic idea, but I will create another video with more detail for those who want to dive deeper. Stay tuned!
I do use malloc/free in a couple of places where it makes sense to me, but you are likely wondering about the whole memory management method. Watch this video by Casey Muratori and it will make more sense why use a memory arena (instead of malloc/free everywhere) th-cam.com/video/xt1KNDmOYqA/w-d-xo.html
Web server in Rust actually makes sense. There's libraries around it and you can get similar performance to C. That is, if you don't hate Rust's borrow system.
@@gamechannel1271 I intentionally move away from libraries and frameworks that make things quick and easy at the beginning but soon enough make your software much more complicated than it needs to be. Simplicity is my goal 🙂
@@gamechannel1271 I built a web server template/framework in C++. The hardest part * State tracking when processing requests * Exceptions. Are they a 400 or a 500? The full cause of the exception cannot be known in the catch block. I liked the epoll API though.
Good job Roy! Very impressive
Wow, this is a very new channel. Hope you achieve great success in the future.
Its hard for people to escape from the javascript frameworks spiral into the low level stuff, great work ❤❤
You should not use sprintf with user- provided data. Use snprintf
Sprintf and snprintf functions already add null terminator.
The length of formatted string should be found not by strlen(), but by using the return value of sprintf
@@alexeydmitrievich5970 For sure I need to up the security 🙂 but the reason I don't use snprintf it's because it's not available in ANSI C. I use that version of C because of simplicity th-cam.com/video/443UNeGrFoM/w-d-xo.htmlsi=4bWn3YqXHqFtnbOb
Wow- this is insane
Did you implement a dictionary without hashing for your environment? Curious as to way you chose to do it that way.
I did! The main reason was to optimize for memory locality and reduce the number of instructions sent to the CPU. Given that the dataset in this case remains relatively small, this approach provides better performance. If the dataset were expected to grow significantly larger, I would have opted for a traditional hash table for better scalability.
This kind of low-level control is the sort of freedom you lose in higher-level languages.
Nice vid. Is the voice really AI tho?
If yes, what tool did you use?
@@jannes6666 I used elevenlabs.io for the AI voice
I had no idea, now I cannot unhear it
@@dev.roysalazar wait this voice use ai??
@@noertri618 yep
did you try Vlang
@@dimitrobest5293 I haven't. I would love to try Jai when it comes out though.
Can u teach us? In more detail?
Yes, I would like that. I am thinking, though, about what would be a good method. 🤔 Maybe I could invite someone with no previous experience in C to walk through the project with me. They could ask any questions they have, giving me fresh eyes on the project.
@dev.roysalazar that someone could be me since I know c but didn't developed any projects but I am currently doing my Masters so we have to talk about time. Also I am a python dev and I also always wonder how these things worked inside the hood. It would be really great If you gave us a walk through, also can we connect on socials?
@@dev.roysalazarIf you decide to go that path, I'd love to participate!
@@dev.roysalazarOh that's a great idea, I would love to participate
@@dev.roysalazar What an outstanding and ingenious idea! It would be an absolute honor to contribute or assist in this ❤🫡
Blazingly fast
For now all I can say is that my web server implementation requires fewer CPU instructions for handling requests compared to using something like Node.js, simply because it doesn't rely on the same number of levels of abstraction to perform the "same" task. But, my intention is for sure to eventually make it Blazingly fast! 🚀
The thing is that you created a great project, but you skipped a lot of things and assumed many things from your viewers such as knowing async architecture's implementation, why arenas are useful for memory management, and some linux sys calls, fork().
It would be really great if you you dive deep into these things in a bit more detail so it allows us to understand the underlying workings.
I tried to make the video so that any software developer can grasp the basic idea, but I will create another video with more detail for those who want to dive deeper. Stay tuned!
why not use malloc and free?
I do use malloc/free in a couple of places where it makes sense to me, but you are likely wondering about the whole memory management method. Watch this video by Casey Muratori and it will make more sense why use a memory arena (instead of malloc/free everywhere) th-cam.com/video/xt1KNDmOYqA/w-d-xo.html
Web server in C 💀
Web server in Rust actually makes sense. There's libraries around it and you can get similar performance to C. That is, if you don't hate Rust's borrow system.
@@gamechannel1271 I intentionally move away from libraries and frameworks that make things quick and easy at the beginning but soon enough make your software much more complicated than it needs to be. Simplicity is my goal 🙂
@@gamechannel1271 I built a web server template/framework in C++. The hardest part
* State tracking when processing requests
* Exceptions. Are they a 400 or a 500? The full cause of the exception cannot be known in the catch block.
I liked the epoll API though.
PHP is written in pure C and it's a massive project.
@@Leonhart_93 jvm its written in C++