Hacker Newsnew | past | comments | ask | show | jobs | submit | pretzelhammer's commentslogin

As the article mentions, the test server had 12 cores. The Node.js server ran in "cluster mode" so that all 12 cores were utilized during benchmarking. You can see the implementation here (just ~20 lines of JS): https://github.com/pretzelhammer/using-rust-in-non-rust-serv...


Author here. The benchmarking tool I used for measuring response size was vegeta, which ignores HTTP headers in its measurements. I believe the difference in size is indeed in the QR code images themselves.


Author here. I believe I generated both of those images using the Rust lib, they shouldn't be used for comparing the compression performance of the JS lib vs the Rust lib.


Interesting, but neither lines up with the size from the benchmarking? You would expect the Rust one to match?


Here's the list of my benchmark targets: https://github.com/pretzelhammer/using-rust-in-non-rust-serv...

Vegeta, the tool I used for benchmarking, iterates through all those targets round-robin style while attacking the server and then averages the results when reporting the average response size in bytes (and it only measures the size of the response body, it doesn't include other things like headers).

Even using the same library and same compression algorithm not all 200px by 200px QR code PNGs will compress to the same size. How well they can be compressed depends a lot on the encoded piece of text as that determines the visual complexity of the generated QR code.


I see. I misread the article as implying that only the specified URLs were being benchmarked.


I wrote 4 tiny brainfuck compilers in Rust targeting x86, ARM, WebAssembly, and LLVM. The code is 100% safe Rust and is dependency-free. Excluding shared code (just the brainfuck parser) each compiler is standalone and is between just 100-180 lines of Rust. To share my learning experiences I wrote an accompanying article called Learn Assembly by Writing Entirely Too Many Brainfuck Compilers in Rust which goes into detail of how I arrived at all my implementations: https://github.com/pretzelhammer/rust-blog/blob/master/posts...

Please let me know if you have any questions or feedback. Thank you!


I also came to Rust from JS! I plan to write an article in the future comparing Rust to Typescript.


Hi, document author here. I learned Rust because I was too scared to learn C++, lol.

Rust has a steeper learning curve than most languages but it also has a very beginner-friendly and welcoming community. So don't be scared, you can do it! If you get stuck on something it's always easy to get help.


As someone who doesn't know Rust yet I feel there's a "do this instead" missing to point 8. It's not clear to me how to do it instead.


Hi, author here. I enjoy reading about programming and I think it's fun, just not _as fun_ as programming. I tried to choose my words carefully because I didn't want to come across like I was bashing reading. Perhaps I should have said, "reading about programming is fun but programming is even more fun."

Learning the hard concepts in Rust is the best part, but The Book isn't going to teach you those. The Book, by design, is a very broad but shallow overview of the entire language. It'll never teach you, for example, why you can't write a self-referential struct in Rust. That's a lesson every Rustacean has to learn the hard way: by programming in Rust. And that's what I hope to encourage more Rust beginners to do: learn the hard lessons by actively programming in Rust.


I get where you're coming here, maybe the concepts in the book weren't difficult for you, but they were for me. I tried Rust without the book and got disillusioned so quickly as I didn't have the vocabulary to understand the docs or a lot of discussion (stack overflow etc) i bought the book and it openened up so much understanding for me and now I have a couple of Rust projects on the go.

I guess it upset me a bit because I didn't find Rust fun at all until I had the book and I could see how your piece could discourage people from buying it.


Hi, author here. Rustlings took me only a few hours but I came back to it after I had already finished reading The Book and finished about ~100 exercises between LeetCode and Exercism, so my experience with Rustlings wasn't that of a "true newbie". I still think it's one of the best resources out there, but like anything it can continually improve.

Your feedback as a beginner is very valuable! If you have some structured feedback for Rustlings please consider opening an issue on the repo. Also, the official Rust Discord Server is very beginner-friendly and has a #beginners channel, if you're struggling with anything don't be afraid to join and ask your question. The invite for the server is here https://discord.com/invite/rust-lang


A Rustacean recently started https://tourofrust.com/ as the Rust-version of the Tour of Go! It's still WIP but looks pretty great so far.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: