I ported h2spec to Rust (also: codegen!)

  Рет қаралды 26,300

fasterthanlime

fasterthanlime

Күн бұрын

Пікірлер: 59
@fasterthanlime
@fasterthanlime 5 ай бұрын
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/fasterthanlime - You’ll also get 20% off an annual premium subscription. Early access: fasterthanli.me/videos/h2spec-to-rust Errata: (nothing yet!)
@snipsnap9995
@snipsnap9995 5 ай бұрын
Gotta say, I really expected a betterhelp sponsorship just how, I'm happy it was Brilliant instead but unless that misdirect was on purpose to make fun of Better help sponsorships this was a pretty strange way to promote Brilliant?
@BertPdeboy
@BertPdeboy 5 ай бұрын
There is an old rule for creating engaging stories; You are allowed one lie. You can make up butt-faced aliens climbing up from the earths core on jetski's, one lie is forgiven by your audience. Every other event must have a logical reason, an objective "yes, how else would you suggest to do this" causality. Your audience will not forgive more lies, and boo at the cinema screen and popcorn will fly around the room! Amos wrote, acted in, and edited, a moving story with **zero** lies. 💪
@danminshew2778
@danminshew2778 5 ай бұрын
Guys will literally do anything to avoid writing a unit test.
@nometutentegiapreso
@nometutentegiapreso 5 ай бұрын
It's not a fasterthanlime video if I don't need to watch it twice in a row to understand what's going on 😎
@FlanPoirot
@FlanPoirot 5 ай бұрын
still faster than reading his bible long articles lol
@basix250
@basix250 5 ай бұрын
Cool, another HTTP implementation in Rust!
@efferington
@efferington 5 ай бұрын
ahh if only ThePHD could have done their talk. goddamnit rust!!
@gfasterOS
@gfasterOS 5 ай бұрын
Even Rust cannot escape TableGen cranelift has its own DSL for generating machine instructions that does a whole ton of code generation. GCC does the same and so does LLVM (where TableGen is from). Maybe one day proc macros can replace this code generation case but that day is not today.
@aleksandermirowsky7988
@aleksandermirowsky7988 5 ай бұрын
The production value gets better with every new video! Even the sponsorship section was done really well.
@Cmanorange
@Cmanorange 5 ай бұрын
i've done some ungodly things with proc macros to the point where i tried to come back to it 2 days later and i had no idea how to follow the flow of my own macros. rust foundation please finish introspection!
@dminik9196
@dminik9196 5 ай бұрын
The purity of proc macros is a bit unfortunate even if understandable. A while ago I wanted to do some code injection into an asmjs app. I wanted to do this semi-automatically by annotating the rust library with proc macros and then parsing both my lib as well as the asmjs source and patching it based on metadata generated from the proc macros. In the end I ended up using a feature flag in the proc macro that would either modify the injected function and pass in some extra values or generate calls to the inventory crate. This would then be collected into a json by using the example(?) binary type in cargo.
@emcell2
@emcell2 5 ай бұрын
wow... what an insane good skill to articulate your tree of thought. Impressive!
@johnlewis794
@johnlewis794 4 ай бұрын
@fasterthanlime couldn't you have made a proc macro at that you call at the crate level on `httpwg` that iterates through each module looking for tests matching your criteria and writes an impl block for some type that builds up your test suite? that way it recurses properly without being stateful and you only have to write one proc macro. I know it would still have to parse a lot of syntax but you could probably internally just feed syn individual modules instead of the whole crate
@qwfp
@qwfp 5 ай бұрын
re: git hooks @ 14:11, aren't git hooks "disabled" by default? I thought that they are not committed to the repo and you have to copy them over manually (or use something like the `pre-commit` tool). Which makes sense, because they can run code without you knowing.
@qwfp
@qwfp 5 ай бұрын
Now I see that you're using cargo-husky, so I guess you're actually referring to naughty contributors who don't run tests 😅
@spicybaguette7706
@spicybaguette7706 5 ай бұрын
Cool project, I have been trying to figure out using io_uring with hyper. But its IO model doesn't really map that well to zerocopy. You really need to let the io runtime/glue take over the buffers for maximum performance with zero copy, I believe. Because you can register pages with io_uring, so that they can stay memory-mapped by the kernel. Maybe this could be solved by an allocator interface (like the unstable `Alloc` trait) that hyper can use? This way you can allocate from the registered pool of memory. Also, when sending buffers you should hand over ownership to the kernel until it yields control of the buffer to the application again (TCP ACK? Or maybe the NIC copies it into it's own internal buffer, idk). And then I gave up😅 And is there even an async runtime that implements io_uring networking? I looked at glommio but it only seems to use io_uring for filesystem access
@edgedlt
@edgedlt 5 ай бұрын
You have an amazing ability to de-mystify 100 things at a time for me and I love you for it
@duality4y
@duality4y 2 ай бұрын
have you ever thought about writing compilers or interpreters?
@TheAnkanOfficial
@TheAnkanOfficial 4 ай бұрын
how do you learn about this concepts
@somoscode4151
@somoscode4151 5 ай бұрын
cat hair flying around while he throws his hands around... there are only two kinds of people in this world I suppose. Cat vs Dogs. :)
@Xeros08
@Xeros08 5 ай бұрын
No VS. Cats & Dogs. I love both 😊
@2khz
@2khz 5 ай бұрын
Awesome video, super interesting as always! Can't wait for another fasterthanlime 40-minute-video-saga-classic when you have the funding and time! Put it on the backburner and there'll be an opportunity eventually :) I appreciated the mouth trumpet (tuba?) at the end with the cloth as a pop-filter. Got a sock on my microphone and it works just fine.
5 ай бұрын
When working on the plane. How do you deal with cargo dependencies on a new project? One can use cargo fetch or cargo vendor for established projects, but how do you deal with that when experimenting on new projects? Local crates mirror?
@Comeyd
@Comeyd 5 ай бұрын
std only maybe?
@somebody_on_the_internetz
@somebody_on_the_internetz 5 ай бұрын
Local crate hub?
@shadamethyst1258
@shadamethyst1258 5 ай бұрын
rustdoc's json output has saved me once before. Such a lovely feature to have :)
@koutheir22
@koutheir22 5 ай бұрын
There is, at least, one reason to regenerate Rust bindings from C header files, every time a *-sys crate is built: the generated Rust bindings are platform-specific. C types will be translated to different Rust types, depending on which platform is being targeted by the build. Also, the C preprocessor might define constants and types in different ways depending on platform-specific macros. For example, (1) the C type "long" will be translated sometimes to Rust i32, and other times to Rust i64. The only way I can think of avoiding this regeneration is by caching the bindings for every single supported OS/Architecture/ABI (i.e., target triple), and that doesn't seem like a sustainable idea, even if it would avoid the need for build dependencies and a C compiler tool chain.
@SimonBuchanNz
@SimonBuchanNz 5 ай бұрын
The windows crate at least can know exactly what all the possible ABIs are, so it uses a macro that generates the correct extern decl for the current target. For other platforms, in theory you could do the same thing that bindgen does to figure out the in a proc macro, but... I'm pretty sure it actually just uses clang as a library to mostly compile the header down to the ABI that clang proper would use. Don't think we want to do that in a proc macro ...
@koutheir22
@koutheir22 5 ай бұрын
@@SimonBuchanNz Windows is the easier case, because of how few ABIs it supports (5 or so). The *-sys crates I was talking about target more platforms than the x86_64-pc-windows-msvc ABI, including Linux, FreeBSD, MacOS, bare metal, etc.
@flyingsquirrel3271
@flyingsquirrel3271 5 ай бұрын
That little pink ear at 6:56 made me happy. I once had a lovely white cat that ALWAYS wanted to sit on top of people :)
@xurtis
@xurtis 5 ай бұрын
“A series of unfortunate events” is such an understatement
@QuietMisdreavus
@QuietMisdreavus 5 ай бұрын
Big fan of using intermediate data formats for crimes. Beautiful work!
@LibreGlider
@LibreGlider 5 ай бұрын
I understand the words individually, but I need to rewatch at least twice to understand them all together...
@somebody_on_the_internetz
@somebody_on_the_internetz 5 ай бұрын
The outro really caught me by surprise, really informative and interesting video
@thegioveZ
@thegioveZ 5 ай бұрын
What monospace font are you using in the video?
@dcnick3
@dcnick3 5 ай бұрын
You could also use libtest-mimic or similar to build a custom test harness that has test cases generated in runtime (from the central test registry you could have collected)
@narigoncs
@narigoncs 5 ай бұрын
This is awesome. I absolutely love it.
@recklessroges
@recklessroges 5 ай бұрын
The bear necessities, the simple bear necessities...."
@joseepifanio8515
@joseepifanio8515 5 ай бұрын
Where did you get your shirt?
@morglod
@morglod 5 ай бұрын
"I decided port it to rust" then "don't repeat yourself" Okey okey
@hikingpete
@hikingpete 5 ай бұрын
I don't usually sub before I check out a back catalogue, but with a description section that comprehensive I'm sold.
@EngineerNick
@EngineerNick 5 ай бұрын
Due that outro was first class!
@piraka_mistika
@piraka_mistika 5 ай бұрын
That was a great ad
@dantenotavailable
@dantenotavailable 5 ай бұрын
I swear that "Life is too short for long builds" was a slogan for some product but for the life of me I can't find it.
@JoeJoeTater
@JoeJoeTater 5 ай бұрын
People also might not want to run "trust me bro" binaries on their dev environment...
@bowarc
@bowarc 5 ай бұрын
wow
@spicybaguette7706
@spicybaguette7706 5 ай бұрын
Rust BTW😎
@korigamik
@korigamik 5 ай бұрын
Interesting
@Lena-qg8bd
@Lena-qg8bd 5 ай бұрын
second
@MechMK1
@MechMK1 5 ай бұрын
The constant over-gesturing is really difficult for me to deal with. I can basically only listen to the video and not watch it.
@yarden-zamir
@yarden-zamir 5 ай бұрын
I'm the other way around 😂
@LunarLaker
@LunarLaker 5 ай бұрын
autism is a spectrum my friend
@sandworm9528
@sandworm9528 5 ай бұрын
Haha you would hate talking to me 😂
@qbasic16
@qbasic16 5 ай бұрын
third
@joranmulderij
@joranmulderij 5 ай бұрын
first
@benjins
@benjins 5 ай бұрын
Always impressive how much information you're able to fit into a (relatively speaking) short video, and still have a decent flow
Learn Rust Together: Making an HTTP Request
50:29
Tom McGurl
Рет қаралды 12 М.
Learning C - Build Your Own Lisp [1]
2:16:48
Domagoj Mišković
Рет қаралды 1,8 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
Молодой боец приземлил легенду!
01:02
МИНУС БАЛЛ
Рет қаралды 1,9 МЛН
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 14 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 43 МЛН
POV: I'm on my third coffee and you just asked me how the internet works
21:20
Highlighted code in slides
11:58
fasterthanlime
Рет қаралды 5 М.
strace feels like magic - let’s fix that (with Rust)
16:21
fasterthanlime
Рет қаралды 49 М.
Rust vs Go: Performance Benchmark in Kubernetes #205
17:16
Anton Putra
Рет қаралды 168 М.
GitHub Actions Feels Bad
26:27
fasterthanlime
Рет қаралды 97 М.
Interview with Senior Rust Developer in 2023
9:46
Programmers are also human
Рет қаралды 739 М.
The Star Language that will outshine Rust? Gleam
10:33
Code to the Moon
Рет қаралды 40 М.
A Practical Introduction to Derive Macros in Rust
9:31
Schrödinger's Watermelon
Рет қаралды 15 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН