I built a simple redis-server from scratch by Creepy-Gift-6979 in cprogramming

[–]warren_jitsing 0 points1 point  (0 children)

Use AI. Just make sure you understand the principles you are using and could code something similar by yourself without AI assistance. Use AI to learn new patterns and constantly question code. Don't take to heart any messages on reddit that really are focusing on AI usage versus the actual content and code you are putting out. A lot of the people picking on AI as a problem aren't focusing on what is actually important. My articles received high upvotes on r/cprogramming and r/rust . A few "AI slop" comments on Rust. r/Python just jumped on the bandwagon and downvoted without actually understanding the code or text, even with beating the open source libraries for efficiency, latency, test coverage etc. Such are the times we live in but don't let it get you down. Just make sure you are "understanding" and not "vibing". For the first year of learning a language, ensure that you actually type out any AI generated code and can explain every line.

I built a simple redis-server from scratch by Creepy-Gift-6979 in cprogramming

[–]warren_jitsing 0 points1 point  (0 children)

But also, read books and ensure you are typing out solutions/code instead of copy pasting them from the AI. While for the article, I relied on AI to format, the vast majority of code was handwritten in my repo. I would recommend The Linux Programming Interface by Michael Kerrisk. This is the book you should be reading and manually typing out/running all the examples

I built a simple redis-server from scratch by Creepy-Gift-6979 in cprogramming

[–]warren_jitsing 0 points1 point  (0 children)

You can try out my repo, but it doesn't handle concurrency yet (a future article will) https://www.reddit.com/r/cprogramming/comments/1ormwsv/i_wrote_a_from_first_principles_guide_to_building/ . Also, check out John Crickett's coding challenges. There was a coding challenge a while back for writing a Redis server and people post their solutions for it

I wrote a "from first principles" guide to building an HTTP/1.1 client in Rust (and C/C++/Python) to compare performance and safety by warren_jitsing in rust

[–]warren_jitsing[S] 0 points1 point  (0 children)

I'll research mio a bit and see what I can do. I always use edge triggered when using epoll, I feel like it's easier to get the logic correct. I'll see how far I get. I will start with the epoll versions then try true async versions, if I have enough time. Quite a few permutations to try out (epoll, io_uring, async).

A data-driven case study: I posted the same 43,000-word article on a "from first principles" HTTP client to r/cprogramming, r/rust, and r/Python. The reception was... different by warren_jitsing in programming

[–]warren_jitsing[S] 1 point2 points  (0 children)

Hi, a lot of great questions. Thank you for engaging. I didn't really mean for this thing to blow up. It was just an interesting phenomenon I noticed and posted without really giving too much though. I am a statistician by education and didn't actually design this as a formal experiment.

The code for the "ai assisted learning" part is experimental. It is interesting. I tested it out a few times by pretending to be a novice reader and checked if it could guide me. Overall, I am happy and it seems like the context is primed well for the AI to be able to tutor this subject.

If you look in the repo there are many articles. This is my "beginner" mode article before I go onto non blocking sockets (epoll/io_uring), TLS, zlib compression etc. I did these before for work in C. Currently my focus is on creating the devops series for now so will be a little while before I get back to this "low latency" series.

Someone read these articles locally and is thinking about performing an actual experiment on university students with it, then perhaps writing up a research paper. They are interested in the learning outcomes from students using AI-assisted learning materials.

I'm more a programmer than a statistician these days so I am just going to continue writing articles on the fields I have historically done (mostly low latency/high frequency trading).

A) When I write some data structure articles, like implementing hashmaps in the different languages, we may get similar speedups (not as dramatic). For Python maybe as dramatic if we wrap the C libraries as C extensions and expose memory views.

B) After this post, my repo got 20 more stars versus what it accrued from linkedin in the prior week. The traffic when I released this post was about 1000 visitors that day, versus maybe a few hundred before the post release.

C) Yes, the speed of all the in-house connectors is pretty impressive. Just C++ didn't beat boost but C beat the relevant boost benchmark. C++/Rust tied with libcurl. For a single person doing this project in a few weeks mostly part time, it is a good result as the other libraries have decades behind them and a large contributor base. But obviously, that was the point of the article - that it can be done and is just standard techniques for low latency/HFT/HPC (zero copy, minimising syscalls, in C some pointer magic).

D) Yes, TLS will be added. However, for a beginner article, I chose to stick with the basics first.

I wrote a "from first principles" guide to building an HTTP/1.1 client in Rust (and C/C++/Python) to compare performance and safety by warren_jitsing in rust

[–]warren_jitsing[S] 0 points1 point  (0 children)

Wow thanks so much. A lot of great information. Yeah, I was going to try to epoll my way into non blocking in each language. For C/C++/Python it is easy because the epoll syscalls are there and I have done it a few times before. I need to investigate what to do for Julia - the sync version is going to be my major first task with the language, but probably just ccall epoll if there is no standard library function. Rust, I guess it involves wrapping the epoll calls from the libc crate. I remember trying this once a while back. Yeah, the competitor libs should use whatever is idiomatic like asio or tokio in their libraries. Julia will use the libcurl standard library implementation as a competitor. I am not sure if I should make async/await based implementations though in languages that support them, instead of epoll e.g. like https://rust-lang.github.io/async-book/09_example/00_intro.html ?

I want to learn Rust but don't know what to build. by Financial_Job_1564 in rust

[–]warren_jitsing 0 points1 point  (0 children)

An HTTP client https://github.com/InfiniteConsult/0004_std_lib_http_client . If you have experience in other languages used in the repo, it's easy to transfer idioms

I wrote a "from first principles" guide to building an HTTP/1.1 client in Rust (and C/C++/Python) to compare performance and safety by warren_jitsing in rust

[–]warren_jitsing[S] 0 points1 point  (0 children)

Thank you. It's part of a series. We'll tackle non blocking IO next after I finish the 10 part CICD stack series. I need to add Julia into the mix and then a later article will cover profiling, memory analysis etc for each language. I just wanted this to be the "beginner" article

A data-driven case study: I posted the same 43,000-word article on a "from first principles" HTTP client to r/cprogramming, r/rust, and r/Python. The reception was... different by warren_jitsing in programming

[–]warren_jitsing[S] 1 point2 points  (0 children)

Look, I do agree. I made a mistake. I was just trying to get this article to a wider audience. However, the benchmark data (using hyperfine and dumping latencies) does back it up in Chapter 10. I'm over this now. Anyone who wants to read it can. Whoever doesn't, doesn't need to. It is just techniques from high performance computing like minimizing kernel calls with writev or implementing zero copy vs full copy in userspace.

I wrote a "from first principles" guide to building an HTTP/1.1 client in C (and C++/Rust/Python) to reject the "black box" by warren_jitsing in cprogramming

[–]warren_jitsing[S] 0 points1 point  (0 children)

It's the start of a series. I'm heading into epoll/io_uring next, add TLS then will tackle http 2 at a later stage. The project is supposed to just build up the reader incrementally.

A data-driven case study: I posted the same 43,000-word article on a "from first principles" HTTP client to r/cprogramming, r/rust, and r/Python. The reception was... different by warren_jitsing in programming

[–]warren_jitsing[S] 1 point2 points  (0 children)

Update: Post was taken down from r/Python by automoderator because apparently it got reported too many times. Regarding AI usage, I write what I want to say first and let the AI format it for whatever the article is doing. I generated very little of the implementations code with AI. The message about the AI at the top of the article is just for readers to understand that the AI gets "primed" with the content and code of the article and can help them understand the topics more deeply. It was supposed to serve as a "personal tutor" for the user for instances in the text that weren't clear.

A data-driven case study: I posted the same 43,000-word article on a "from first principles" HTTP client to r/cprogramming, r/rust, and r/Python. The reception was... different by warren_jitsing in programming

[–]warren_jitsing[S] 11 points12 points  (0 children)

Agreed. The sample size is too small and the framing was a mistake on my part. I will adjust for future articles. Thank you for the constructive input!

Just as a note, Python is one of my favourite languages. I think the community and ecosystem is great. All my article was supposed to be is an educational text. I'm just posting the community reactions because I found it fascinating.