• 0 Posts
  • 123 Comments
Joined 1 year ago
cake
Cake day: September 13th, 2023

help-circle


  • Having to use #[tokio:main] to make the main function async (which should just be inbuilt functionality, btw tokio adds insane bloat to your program) yet you literally can’t write code without it. Also what’s the point of making the main function async other than 3rd party libraries requiring it?

    You’re kidding, right? You do actually understand that languages that aren’t JavaScript don’t have built in async runtimes and they need to be provided by a library, right? You’re not actually writing a post about how much the programming language you have two days experience in made different design decisions and is therefore good at different things than the programming language you have five years experience in and therefore it sucks, right?

    There are plenty of slimmer async runtimes for Rust. Pollster comes to mind, although it doesn’t provide any I/O functionality. (That’s where the “bloat” that’s in Tokio comes from – it’s providing functionality the Javascript runtime has built in. You see, Rust, unlike Typescript and Java that have compilers that emit source code for an interpreter, is actually a compiled language, and Rust programs compile to self-contained executables that don’t need any external dependencies to run. If you included the size of the node binary in your Javascript app, Rust would win the filesize war no contest.)

    As for “performance doesn’t matter” – I’d like to tell you a personal story about a Rust program I’m working on. There’s an imageboard I’m a fan of, and it runs some booru-like software, meaning when you upload an image you give it a few dozen tags, and then people can search for images by their tags. The tag search functionality on the website I thought was missing a few features, so I downloaded a copy of the entire post database on that site (including URLs and tag lists of every post) and wrote my own search algorithm in Rust. I wrote a function that accepts a search query and a list of tags and returns a boolean, and searching the posts was as simple as vec_of_posts.iter().filter(|post| matches(search_query, post)).collect(). I then downloaded the rayon crate, and, with a sngle line change to vec_of_posts.par_iter().filter(|post matches(search_query, post).collect(), I was running the search in parallel on all CPU cores. Running a full search of all four million posts takes about 50 milliseconds on my laptop, or 3 seconds running the search locally on an Android phone. Try that in an interpreted language.

    (So help me God, if you respond to that last point by saying “cloud computing”, I am going to shoot you in the head.)















  • FFmpeg is basically the only piece of audio/video conversion software in widespread use. Everything uses it under the hood. Microsoft Teams used it to stream your webcam. VLC uses it to play video. If you’ve ever uploaded your video to an online service to convert it to a different file format or codec, chances are the server that processed it did so using FFmpeg.

    I have also noticed that FFmpeg kind of sucks at generating stills for reasons I’m not sure about though.