Oddbean new post about | logout
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @buy robux today :ROBUX: @e9ab4887 nigga we're in C++ land murderous compile times are our lifelong friend. 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: only if you use templates and don't pimpl! In rust it's mandatory.

C++ actually compiles insanely fast if you get stuff out of headers 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @e9ab4887 @buy robux today :ROBUX: maybe i should change the way i program in c++, 20 seconds for one translation unit is a norm for me because i use a million header-only template libraries. i should probably employ better practices (especially if i want to be employed lmao) 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: it's relatively straightforward to write fast compiling C++ code but it's very very hard to go back and fix it if you wrote it wrong in the first place. The biggest thing, by far, though is get templates out of your headers. 

also don't use boost. Nobody uses boost anymore. We USED to use boost because it had a bunch of stuff that was useful before it got put in the standard. Now it's in the standard and boost is just pure cancer and kills everything it touches. 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @e9ab4887 @buy robux today :ROBUX: boost::asio seems pretty useful (its the only boost library i use) but other than that yeah, theyre pretty redundant. but i feel like a lot of the STL headers have the same problem as boost too since a lot of them actually come from boost in the first place and shit like <algorithm> and <numeric> are almost entirely template-based. it's hard to get out of this template jail im in (i would like some tips).
Rust basically mandates this with traits (concepts but :sane:) but that's another story i guess.

https://media.clubcyberia.co/pleroma/f90d933f208ae15b41a92089ee3f0df2b103438c91d5412a94cfb619b8c38c49.png 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: the containers in the stl are of the same nature as the ones in boost but boost writes them in the most retarded way possible with, possibly not an exaggeration, 300 nested templates inside eachother. It's good to not include stl libs in class headers where reasonable but I have never experienced significant slowdown from them. Including even one single boost header can triple your compile time instantly.

I mean come on you saw that template error right? Is that not the most satanic thing you've ever laid eyes on?

If you MUST use boost you should write an adapter class that just declares the functions you need in a header and then the implementations can actually call the boost functions. That way you only poison a single cpp file. I did this with good success in my last project before I just completely abandoned boost. 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @e9ab4887 @buy robux today :ROBUX: what's your thought on <regex>? it was so slow i just resorted to using boost::regex and calling it a day. or maybe i should use RE2.
also how do you do networking in C++ without asio? 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: regex in general is quite slow and the use of it should be pretty selective. I've never found c++ regex to be particularly troublesome as long as you're sure to precompile your statements. For networking there's various libraries everywhere. Socket calls suck but the abstraction layer over them doesn't need to be very fancy before they start not sucking. So in short figure out what you actually want to do with your sockets and there will be a very simple and reliable library for it. 
 rust is next level, the entire crate is considered one compilation unit. It’s probably good for inlining though.