- Shitting on Python - Shitting on C++ - Shitting on OOP - Baiting Rusties - Implying that C allows some unsafe design patterns - Not even considering traditionally functional languages because of performance reasons It's... beautiful. Every single programmer has been offended equally. Impressive. The only way to have it done even further would be baiting C fans and saying "Anyways, I'll use Java and let the JVM handle the memory optimizations".
As someone who would generally say my favorite language is C, "C allows some unsafe design patterns" has gotta be one of those "understatement of the year" moments.
In the late 90s when I took an intro C programming course the teacher asked us to write a program to calculate Fibonacci numbers. Recursion would overflow the stack as the input grew so instead I used the closed-form Binet formula to avoid this. It also had constant time. Apparently the teacher was expecting a recursion solution as I failed the assignment.
W H A T that's crazy your prof just decided that independent research should be penalized like that. Especially being that this was back in the 90s, before Google.
5:14 This is an excellent lesson that all programmers should know. C++ is more efficient, if you use it correctly. And it's harder to use correctly than something like Python, where smarter people wrote the low-level routines and your job is only to use them as intended. B-but C++ also has high-level routines written by smarter people! Yes, and even they are harder to use. Of course, the optimal play would be to use something like Julia, that presents a simple high-level language like Python and compiles to highly efficient code like well used C++. The language war often misses the point trying to fight over 20 year old languages when we've made such gigantic compiler progress over that time.
Juliaalsohasthings to watch out for! Learning it recently, and code outside of functions can be like 20x slower, even if you're just calling a function in a loop. The magical compile on the fly thing is super cool, but full of surprises.
@@ZeroPlayerGame you can use @code_native to see the assembly generated for a function call. But you are right, Julia runtimes are much more obscure to predict than C.
it's honestly amazing how he can pull up complex classes making a dumb point about control flow, but he can't use std::move or even just move auto tmp inside the loop to actually have a move instead of a copy.
9:06 tmp doesn't actually go out of scope because you declared it outside the loop. Even if it did, unfortunately the C++ standard has very strict rules for copy elision. Each value in C++ has not only type, but also a category. Unfortunately, value categories are not that of category theory, but there are 2 of them: l-values (something you can assign to) and r-values, which we can further divide into pr-values (roughly speaking, results of expressions unless they explicitly return l-values), and x-values (something that would be an l-value but it was derived from something explicitly marked as an x-value). On top of it, there are also NRVO rules that allow a return statement to sometimes convert its argument to a pr-value if it's just a local variable with no shenanigans (not x-value IIRC, because reasons). Also note that an r-value reference may itself be an l-value, it merely encodes that the thing it's referencing was an r-value when the reference was being created. tmp is an l-value in your code because it's always assignable. to fix it: (1) declare tmp inside the loop: auto tmp = a + b, and (2) convert it to an x-value explicitly: b = std::move(tmp). Note that you don't have to do anything with the return statement, because this is actually the only place in your code where the compiler's got your back :)
x86 assembly, category theroy jokes, and memes? What an unexpected, delightful combination! It would be interesting to have GMP's mpz_fib_ui() in the plot as a baseline comparison.
@PRiKoL1ST1 I don't really have a reason to. I haven't been using xmonad for about 3 years, I don't know if waymonad is even a thing, and my life is difficult enough due to nix. EDIT: also I don't really know of other things I can use/want to write that use Haskell.
14:40 in fact, doing something like this can often make your code slower as the compiler may be unable to recognise what you want to do and optimise accordingly
"With great speed comes great cppaghetti" is probably _the_ best pun I've heard so far. Not very surprising it shows up here given the ~~video's~~ channel's propensity for being as joke-filled as it is informative.
Why move anything? Hold 3 big enough numbers. put 0 in n_1, 1 in n_2, n_3=n_2+n_1 destructively, n_1=n_3+n_2 destructively, n_2=n_1+n_3 destructively, repeat the last three additions in groups of three for as long as you like. At the end of the loop, just take n_2.
2:07 Haha classic, you forgot to turn off stdio sync and untie cout from cin, freaking *everybody* makes this mistake at least once in their life. I'm officially granting you the title of honorary programmer.
The invocation of std::endl is the biggest sin here. The synchronized C++ stream, while not using a buffer of its own, still uses the buffer of its synchronized C stream, and you don't pay for flushing standard output if you never read from standard input.
Watching a video on this channel that I can _actually_ understand feels really refreshing - and I gotta say, this definitely makes it one of my favorites!
9:56 just make sure you never reserve space in a vector that you haven't created in the same function, because that's one easy way of getting an accidentally quadratic algorithm if you then call this function on the same vector in a loop. Unfortunately, C++ doesn't protect you from this footgun. You can however write your own version of reserve that rounds the capacity up to a power of two, then only performs the reserve if the current capacity is smaller.
Can you leave the memes onscreen for a second longer? I’m watching on my TV which takes a sec to pause and only scrubs in 5 second chunks, so it’s a bit hard to rewind and time the pause perfectly each time to see the memes. Totally a me problem, but just sayin’.
Real. I read pretty quick, so I could catch most of them in real time, but a bit more time would make them easier to digest and make the jokes and implications hit harder.
The ONE time C is better (well, there are a couple other cases, but they're admittedly just as rare and obtuse as this). Now in C23, you can write big ints as `_BitInt(128) a = `. No special classes, no operator overloading code, no inline assembly when you want to use the ADC instruction to flex, no attempting to SIMD your operator overloading code when you _really_ want to dunk on Python -- the compiler will do all that for you. Just raw, concentrated crack -- er, I mean, speed, don't tell Mom. Note that the C23 standard only _requires_ a minimum of 128 bits to be implemented -- larger widths are optional.
you didn't say I can't use compiler extensions or keep track of 2 uint64_t's (not like it would be hard to do for this purpose). __int128 has been a thing for quite a while. you're stealing constexpr and auto and nullptr and actual true/false and empty initializers (because doing ={} is some big brain thing) from us in C23, we're stealing stdbit.h and stdckdint.h and #embed from you, we're even
12:30 Actually thought I'd know where all possible direct function calls there are, but a bit confused about some of the ones listed. What I would have thought would happen was: default constructor x default constructor y (maybe comma call x,y but unsure if they would be called there. Probably not) enum cast/constructor SEPARATED enum cast/constructor SHEAF operator=(x) operator=(y) operator,(x,y) (but ffs no one should ever do this) ~x ~y What I only realized after I saw your code was that the comma operator could be for an entirely different type whose constructors themselves could take by copy instead of by which would be 4 additional constructors and destructory, so then we have default constructor x default constructor y enum cast/constructor SEPARATED enum cast/constructor SHEAF operator=(x) operator=(y) copy constructor x_copy copy constructor y_copy constructor comma_y constructor comma_x operator,(comma_x,comma_y) (STILL no one should do this) ~comma_x ~x_copy ~comma_y ~y_copy ~x ~y But that's still missing 6 more I guess you're then in the constructor for sheafy_comma calling the copy constructor another 2 times and then destucting those 2 copies as well, but I personally wouldn't say any of those 4 were called directly by the main function (neither would I say the 4 calls from a function taking its arguments as copy would but let's for the sake of argument call all of those) but even if you count those there's 2 more missing so I'm somewhat confused where the last few come from Edit: oh only just noticed that you implemented the operator, as taking the operands by value instead of by reference so I guess that should add another 4 calls, and with the 2 you said don't count I guess that's 23 now (though I still wouldn't really count function calls done because of pass by copy as being done by the one calling the function, but instead by the function itself) Still in general it's fair to say that in C++ you need to be aware that most things can be overloaded and if anyone in your chain of function calls has some bad overloads that can quickly cause issues
I for fun decided to try out the code that printed billion numbers on my machine as well, tho with only million numbers due to being inpatient. Python took about 4,5 seconds and c++ both with std::endl and and also c with printf all took about 2,5 seconds. And I didn't use any compiler optimizations. Not sure why such a big difference compared to what you got. Maybe its due to printing less numbers, but I doubt it since million prints is already quite few. And I also run each one several times, no noticeable differences between different runs with any of them. Edit: I tried using compiler optimizations. With them instead of c, and both c++ versions taking 2,5 second plus or minus 0,1 seconds, now they all take about 2,2-2,5 seconds. Still no noticeable differences between them.
There must be something wrong with your measurement (or you're maybe running the same program multiple times by mistake). The trivial count to a million loop in C++ takes about 1.0 second for me (wherein almost half of the time is spent in the Linux kernel according to user/sys timing, because it's invoking the write syscall a million times) with std::endl, yet only about 0.06 seconds (basically all of it in userspace) with a naive newline. C is about the same with and without explicit buffer flushes, and Python is around 1.8 seconds.
@@D0Samp So I just wrote a somewhat detailed response and after few minutes I came to make a small edit to it and it seems youtube just deleted it. Maybe if I split it in many comments its not gonna get deleted.
@@D0Samp I run them with time ./main1 and time ./main2. Both give basically identical results. User time is about 0.28 seconds and system time is about 1.9-2.2 seconds. Cpu usage is 99%. Total time is about 2.2-2.5 seconds
5:28 my java heart SCREAMS with JOY. FinbonacciSequenceInitialValueGetterFactory my factory love. ComputeNextFibonacciNumberGivenTwoFibonacciNumbersStrategy should probably be ComputeNextFibonacciNumberGivenTwoFibonacciNumbersStrategyCalculatorFactory though, because you never know ;)
I mean... literally all compiler specifics used here can literally be used in C++ too. And so can preallocating the memory. You can even literally calculate the fib number using floating points and powers to get an approximation and use the logarithm on it to get a tight fit for the memory, making it even faster. But yeah. Clearly the language's fault and not the programmer's.
Okay, I'm inspired, enough to do this instead of work. How far can I get in 1 second with c++? fun challenge. thanks, I have enjoyed watching your videos lately.
The de-sheafification of C let's go Frankly, i see this as more of a failing of your hand-rolled bignum than anything else. You super don't need a dynamic array. If you know the sizes of two numbers and a basic operation, the pessimistic estimation of how much space the result takes wastes at most 1 word, and you're also using numbers immutably. #JustUseGMP
Some of the Python Libraries or modules that are available for a programmer to use may not be written in Python. They could be written in C. The Python Interpreter itself I believe is primarily written in C. With that, some of the modules that you use may not fully be interpreted by the Python interpreter. Some of it might be directly compiled into C itself and sort of passed through. I'm not a Python Expert, but I've had some experience with it. Then again, that was a little while back around the transition from Python 2.x to 3.x. There's been quite a few changes, updates, and improvements within Python since then. Just like any other language, Python can end up being very slow. Yet if being used right it can be almost as fast as say C/C++, Rust, etc. In general Python itself will never truly be a faster language than C/C++ simply because its interpreter relies on C as far as I am aware of. However, if you have one programmer that knows how to use Python very effectively and you have another programmer that doesn't know how to use C/C++, the Python Programmer will be able to generate a code base that will outperform that C/C++ programmer 9 out of 10 times. Now if you have two programmers of the same quality and integrity both writing efficient and performant code in both languages, 9 out of 10 times, the C/C++ code is going to be more efficient if performance is their main goal. Finally, if you have a programmer that can write extremely efficient and performant C/C++ code, and another programmer that writes bad Python code. It's going to be a landslide every time.
Because it doesn't. The default Python sys.stdout object is a text-encoding wrapper around a buffered binary writer around the operating system's low-level representation of a file.
Python's range is implemented in C, doing that loop as you would in C++ (perhaps with a while loop) would be even slower than the original C++ endl version. And also what the messages above me have said
I would like to inform you that your video fell victim to TH-cam's autotranslation feature that prevents me from reading the English titles of your videos. If it is in any way possible to deactivate this feature from your side, it would be much appreciated.
In javascript the code is just english, but big capital made it fast af boy. So I believe python literally has no reason to exist with it's cringe whitespace syntax and discarding of language versions (javascript runs the web so it promises backwards compatibility).
5:20 no such word as prog no sis pro gn os is pro gnosis like a gnostic agnostic a gn os tic or mb a gn os t ic idk where the t goes like pre gn ant there is no preg nant but you say std and endl shudder
C(23) better for this. `_BitInt( )` tells the compiler what you want more explicitly and is much faster than a malloced array of __int128s. Hell, just using alloca could probably speed this up something fierce simply due to cache locality. I don't _know_ that he ever allocates more than 4 KiB for his program to use, but if he does, that's probably the weird spike halfway up the chart right before it becomes slightly more chaotic.
this whole video comes down to "I can't be bothered to know about C++, let me make a 17 min long video malding about how Python overtook me cuz I can write complex classes but can't use std::move"
aaaaaaaaaaaa why is youtube pushing sh*tty AI-generated French audio translation tracks by default please mr. video tell me that you can turn that stuff off 🫣
- Shitting on Python
- Shitting on C++
- Shitting on OOP
- Baiting Rusties
- Implying that C allows some unsafe design patterns
- Not even considering traditionally functional languages because of performance reasons
It's... beautiful. Every single programmer has been offended equally. Impressive.
The only way to have it done even further would be baiting C fans and saying "Anyways, I'll use Java and let the JVM handle the memory optimizations".
it's.. it's not rusties!!! it's rustaceans!! 🤬🤬
This right here earned my subscription.
This doesnt affect me because i use scratch
As someone who would generally say my favorite language is C, "C allows some unsafe design patterns" has gotta be one of those "understatement of the year" moments.
"If you didn't get why this is funny, you might need an interpreter" 🤣
read this as they said it 😅
When Sheafification becomes Low Level Learningification:
Apparently Low Level TVification now
In the late 90s when I took an intro C programming course the teacher asked us to write a program to calculate Fibonacci numbers. Recursion would overflow the stack as the input grew so instead I used the closed-form Binet formula to avoid this. It also had constant time. Apparently the teacher was expecting a recursion solution as I failed the assignment.
Tough luck. You couldn't even argue against it?
W H A T that's crazy your prof just decided that independent research should be penalized like that. Especially being that this was back in the 90s, before Google.
Unless the question specifically states you have to use recursion, that's just ridiculous.
5:14 This is an excellent lesson that all programmers should know. C++ is more efficient, if you use it correctly. And it's harder to use correctly than something like Python, where smarter people wrote the low-level routines and your job is only to use them as intended.
B-but C++ also has high-level routines written by smarter people! Yes, and even they are harder to use.
Of course, the optimal play would be to use something like Julia, that presents a simple high-level language like Python and compiles to highly efficient code like well used C++. The language war often misses the point trying to fight over 20 year old languages when we've made such gigantic compiler progress over that time.
Juliaalsohasthings to watch out for! Learning it recently, and code outside of functions can be like 20x slower, even if you're just calling a function in a loop. The magical compile on the fly thing is super cool, but full of surprises.
@@ZeroPlayerGame you can use @code_native to see the assembly generated for a function call. But you are right, Julia runtimes are much more obscure to predict than C.
1:54 Your memes keep getting better and better!
So python has nothing to do with it.
Should've just named the video: "I suck at C++".
it's honestly amazing how he can pull up complex classes making a dumb point about control flow, but he can't use std::move or even just move auto tmp inside the loop to actually have a move instead of a copy.
Your momma raise you to be rude to strangers like that?
@@ZeroPlayerGameWe agree, this dude is way too comfortable disrespecting others and not getting punched in the face for it
9:06 tmp doesn't actually go out of scope because you declared it outside the loop. Even if it did, unfortunately the C++ standard has very strict rules for copy elision. Each value in C++ has not only type, but also a category. Unfortunately, value categories are not that of category theory, but there are 2 of them: l-values (something you can assign to) and r-values, which we can further divide into pr-values (roughly speaking, results of expressions unless they explicitly return l-values), and x-values (something that would be an l-value but it was derived from something explicitly marked as an x-value). On top of it, there are also NRVO rules that allow a return statement to sometimes convert its argument to a pr-value if it's just a local variable with no shenanigans (not x-value IIRC, because reasons). Also note that an r-value reference may itself be an l-value, it merely encodes that the thing it's referencing was an r-value when the reference was being created. tmp is an l-value in your code because it's always assignable. to fix it: (1) declare tmp inside the loop: auto tmp = a + b, and (2) convert it to an x-value explicitly: b = std::move(tmp). Note that you don't have to do anything with the return statement, because this is actually the only place in your code where the compiler's got your back :)
x86 assembly, category theroy jokes, and memes? What an unexpected, delightful combination! It would be interesting to have GMP's mpz_fib_ui() in the plot as a baseline comparison.
1:29 The meme on the right is SOOO accurate!
I got reminded about haskell again. It's such a beautiful language if you can read it. I can't.
If you use arch, you can learn Haskell
@PRiKoL1ST1 I don't really have a reason to. I haven't been using xmonad for about 3 years, I don't know if waymonad is even a thing, and my life is difficult enough due to nix.
EDIT: also I don't really know of other things I can use/want to write that use Haskell.
4:03 A legendary image of Lorem Ipsum.
2:52 Man, Mr. G, the word play… It’s brilliant! (Insert chess “!!”)
14:40 in fact, doing something like this can often make your code slower as the compiler may be unable to recognise what you want to do and optimise accordingly
His next video will be a cooking tutorial on currying in C.
Aside from jokes, I really searched a lot for a video like yours, but I couldn't find any so I sat waiting for another one and here it is!
0:13 The bottom left is a great start for your video, as always!
"With great speed comes great cppaghetti" is probably _the_ best pun I've heard so far.
Not very surprising it shows up here given the ~~video's~~ channel's propensity for being as joke-filled as it is informative.
2:50 "if you didn't get why this is funny, you might need an interpreter"
gold
4:12 G, where did get THAT image from!? 🤣🤣🤣🤣🤣
Why move anything? Hold 3 big enough numbers. put 0 in n_1, 1 in n_2, n_3=n_2+n_1 destructively, n_1=n_3+n_2 destructively, n_2=n_1+n_3 destructively, repeat the last three additions in groups of three for as long as you like. At the end of the loop, just take n_2.
"music by John Cage" lmao
5:36 This is literally me every time I make a program!
2:07 Haha classic, you forgot to turn off stdio sync and untie cout from cin, freaking *everybody* makes this mistake at least once in their life. I'm officially granting you the title of honorary programmer.
Comparing languages' performance by syscalls in a for loop is quite funny. Although the conclusion is correct.
The invocation of std::endl is the biggest sin here. The synchronized C++ stream, while not using a buffer of its own, still uses the buffer of its synchronized C stream, and you don't pay for flushing standard output if you never read from standard input.
but steel is heavier than feathers 😟😟
That all depends on how much steel you have compared to how many feathers you have.
*insert monogatari ost*
"But they're both a kilogram"
Hi G, TH-cam has auto translated the title and description into german, could you please disable the option for autotranslation? Thanks.
Watching a video on this channel that I can _actually_ understand feels really refreshing - and I gotta say, this definitely makes it one of my favorites!
5:29 What am I looking at?
9:56 just make sure you never reserve space in a vector that you haven't created in the same function, because that's one easy way of getting an accidentally quadratic algorithm if you then call this function on the same vector in a loop. Unfortunately, C++ doesn't protect you from this footgun. You can however write your own version of reserve that rounds the capacity up to a power of two, then only performs the reserve if the current capacity is smaller.
The github repo in the description is private :(
Whoops
Fixed the repo link, should be gucci now
Can you leave the memes onscreen for a second longer? I’m watching on my TV which takes a sec to pause and only scrubs in 5 second chunks, so it’s a bit hard to rewind and time the pause perfectly each time to see the memes. Totally a me problem, but just sayin’.
Real. I read pretty quick, so I could catch most of them in real time, but a bit more time would make them easier to digest and make the jokes and implications hit harder.
When you fill up your tank with diesel instead of gas and wonder why it doesn't start
The ONE time C is better (well, there are a couple other cases, but they're admittedly just as rare and obtuse as this). Now in C23, you can write big ints as `_BitInt(128) a = `. No special classes, no operator overloading code, no inline assembly when you want to use the ADC instruction to flex, no attempting to SIMD your operator overloading code when you _really_ want to dunk on Python -- the compiler will do all that for you. Just raw, concentrated crack -- er, I mean, speed, don't tell Mom.
Note that the C23 standard only _requires_ a minimum of 128 bits to be implemented -- larger widths are optional.
1^127=1
@proloycodes shit. Meant to write
you didn't say I can't use compiler extensions or keep track of 2 uint64_t's (not like it would be hard to do for this purpose). __int128 has been a thing for quite a while.
you're stealing constexpr and auto and nullptr and actual true/false and empty initializers (because doing ={} is some big brain thing) from us in C23, we're stealing stdbit.h and stdckdint.h and #embed from you, we're even
I loved the video, as always with your content, but now your honest take on optimization is very useful :D
I wish I could understand better the subjects of your other videos to feel the same rollercoaster of emotions that your mind created.
OMG That was so funny!! Yes, I would like to see the continuation of this video...
12:30 Actually thought I'd know where all possible direct function calls there are, but a bit confused about some of the ones listed.
What I would have thought would happen was:
default constructor x
default constructor y
(maybe comma call x,y but unsure if they would be called there. Probably not)
enum cast/constructor SEPARATED
enum cast/constructor SHEAF
operator=(x)
operator=(y)
operator,(x,y) (but ffs no one should ever do this)
~x
~y
What I only realized after I saw your code was that the comma operator could be for an entirely different type whose constructors themselves could take by copy instead of by which would be 4 additional constructors and destructory, so then we have
default constructor x
default constructor y
enum cast/constructor SEPARATED
enum cast/constructor SHEAF
operator=(x)
operator=(y)
copy constructor x_copy
copy constructor y_copy
constructor comma_y
constructor comma_x
operator,(comma_x,comma_y) (STILL no one should do this)
~comma_x
~x_copy
~comma_y
~y_copy
~x
~y
But that's still missing 6 more
I guess you're then in the constructor for sheafy_comma calling the copy constructor another 2 times and then destucting those 2 copies as well, but I personally wouldn't say any of those 4 were called directly by the main function (neither would I say the 4 calls from a function taking its arguments as copy would but let's for the sake of argument call all of those) but even if you count those there's 2 more missing so I'm somewhat confused where the last few come from
Edit: oh only just noticed that you implemented the operator, as taking the operands by value instead of by reference so I guess that should add another 4 calls, and with the 2 you said don't count I guess that's 23 now
(though I still wouldn't really count function calls done because of pass by copy as being done by the one calling the function, but instead by the function itself)
Still in general it's fair to say that in C++ you need to be aware that most things can be overloaded and if anyone in your chain of function calls has some bad overloads that can quickly cause issues
I for fun decided to try out the code that printed billion numbers on my machine as well, tho with only million numbers due to being inpatient. Python took about 4,5 seconds and c++ both with std::endl and
and also c with printf all took about 2,5 seconds. And I didn't use any compiler optimizations. Not sure why such a big difference compared to what you got. Maybe its due to printing less numbers, but I doubt it since million prints is already quite few. And I also run each one several times, no noticeable differences between different runs with any of them.
Edit: I tried using compiler optimizations. With them instead of c, and both c++ versions taking 2,5 second plus or minus 0,1 seconds, now they all take about 2,2-2,5 seconds. Still no noticeable differences between them.
There must be something wrong with your measurement (or you're maybe running the same program multiple times by mistake). The trivial count to a million loop in C++ takes about 1.0 second for me (wherein almost half of the time is spent in the Linux kernel according to user/sys timing, because it's invoking the write syscall a million times) with std::endl, yet only about 0.06 seconds (basically all of it in userspace) with a naive newline. C is about the same with and without explicit buffer flushes, and Python is around 1.8 seconds.
@@D0Samp Odd. The c++ code main1.cpp
#include
#include
int main()
{
for (uint32_t i = 0; i < (1
@@D0Samp So I just wrote a somewhat detailed response and after few minutes I came to make a small edit to it and it seems youtube just deleted it. Maybe if I split it in many comments its not gonna get deleted.
@@D0Samp So I have 2 different c++ files. main1.cpp is
#include
#include
int main()
{
for (uint32_t i = 0; i < (1
@@D0Samp I run them with time ./main1 and time ./main2. Both give basically identical results. User time is about 0.28 seconds and system time is about 1.9-2.2 seconds. Cpu usage is 99%. Total time is about 2.2-2.5 seconds
5:28 my java heart SCREAMS with JOY. FinbonacciSequenceInitialValueGetterFactory my factory love. ComputeNextFibonacciNumberGivenTwoFibonacciNumbersStrategy should probably be ComputeNextFibonacciNumberGivenTwoFibonacciNumbersStrategyCalculatorFactory though, because you never know ;)
12:40 staring from python land at the horror of having to think of such things 😨
@1:55 `for (const auto num : std::ranges::views::iota(0U, 1U
That @vsauce 😂
I mean... literally all compiler specifics used here can literally be used in C++ too. And so can preallocating the memory.
You can even literally calculate the fib number using floating points and powers to get an approximation and use the logarithm on it to get a tight fit for the memory, making it even faster.
But yeah. Clearly the language's fault and not the programmer's.
The casting - void in the fake credits made me spit out my drink lmao
next video: what is sheafification
This is entertaining and interesting. Intertainment!
Interpreter joke was amazing
10:14 the hate for MSVC🤌🤌🤌
Okay, I'm inspired, enough to do this instead of work. How far can I get in 1 second with c++? fun challenge. thanks, I have enjoyed watching your videos lately.
ayyy a video i could follow along 🎉
Hmm my friend says why matmul method is denoted as О (n²), if they remember right it should be ~О(n*log(n))? (he has no hands I type for him)
You never dissapoint 🤣
I'm curious how said naive implementation would work in go
5:03 Can somebody explain how this tweak works?
The de-sheafification of C let's go
Frankly, i see this as more of a failing of your hand-rolled bignum than anything else. You super don't need a dynamic array. If you know the sizes of two numbers and a basic operation, the pessimistic estimation of how much space the result takes wastes at most 1 word, and you're also using numbers immutably.
#JustUseGMP
btw std::vector::swap
How insightful video
good stuff. now write it in web assembly 😂
if we're so concerned with what assembly the compiler generates, why don't we just write the assembly directly and skip the middleman?
Because the assembly written by a compiler often is better than the assembly that you wrote.
because u dont know how to write assembly lol
who said anything about *me* writing it
11:23 hahaha, love it
Now use constexpr for 0 computation time
So how come the python program was still faster if it too flushed the print statements after every line? 🤔
Some of the Python Libraries or modules that are available for a programmer to use may not be written in Python. They could be written in C. The Python Interpreter itself I believe is primarily written in C. With that, some of the modules that you use may not fully be interpreted by the Python interpreter. Some of it might be directly compiled into C itself and sort of passed through. I'm not a Python Expert, but I've had some experience with it. Then again, that was a little while back around the transition from Python 2.x to 3.x. There's been quite a few changes, updates, and improvements within Python since then. Just like any other language, Python can end up being very slow. Yet if being used right it can be almost as fast as say C/C++, Rust, etc. In general Python itself will never truly be a faster language than C/C++ simply because its interpreter relies on C as far as I am aware of.
However, if you have one programmer that knows how to use Python very effectively and you have another programmer that doesn't know how to use C/C++, the Python Programmer will be able to generate a code base that will outperform that C/C++ programmer 9 out of 10 times. Now if you have two programmers of the same quality and integrity both writing efficient and performant code in both languages, 9 out of 10 times, the C/C++ code is going to be more efficient if performance is their main goal. Finally, if you have a programmer that can write extremely efficient and performant C/C++ code, and another programmer that writes bad Python code. It's going to be a landslide every time.
Because it doesn't. The default Python sys.stdout object is a text-encoding wrapper around a buffered binary writer around the operating system's low-level representation of a file.
Python's range is implemented in C, doing that loop as you would in C++ (perhaps with a while loop) would be even slower than the original C++ endl version. And also what the messages above me have said
5:20 this is why oop v trad is
is python or casm faster
be cause duality
5:30
you almost made sense
0:10 RIP
tis indeed just a prank, bruv
7:15 i just realized you speak in python i speak in asm
Whats "Tsuzuku" ?
continue
Why does your shell look like a greentext lmao
the answer is 11. Or 23. I haven't watched the video
also love
much love
imagine if instead of c++ it was called g++ 😂😂😂😂😂😂😂😂😂😂😂😂
yay new (g⁺)⁺ video
I would like to inform you that your video fell victim to TH-cam's autotranslation feature that prevents me from reading the English titles of your videos. If it is in any way possible to deactivate this feature from your side, it would be much appreciated.
Ooh!
lol this vid is amazing
Not satisfied with this video
In javascript the code is just english, but big capital made it fast af boy. So I believe python literally has no reason to exist with it's cringe whitespace syntax and discarding of language versions (javascript runs the web so it promises backwards compatibility).
You are clearly confused and stressed, probably it's because you had to write all those nasty semicolons and curly braces... 🤭
As a c bro im laughing at the c++
5:20 no such word as prog no sis
pro gn os is
pro gnosis
like a gnostic
agnostic a gn os tic
or mb a gn os t ic idk where the t goes
like pre gn ant
there is no preg nant
but you say std and endl
shudder
There is a explicit formula to compute the nth fibonacci number without computing its predecessors.
Ha! Laugh at this person. They did not watch the soft requirement video preceding this one.
@JPK314 Exactly. I did not. Go on. Laugh at people who don't watch a video.
Oh man, don't make it any more awkward. Just learn C++.
C(23) better for this. `_BitInt( )` tells the compiler what you want more explicitly and is much faster than a malloced array of __int128s. Hell, just using alloca could probably speed this up something fierce simply due to cache locality. I don't _know_ that he ever allocates more than 4 KiB for his program to use, but if he does, that's probably the weird spike halfway up the chart right before it becomes slightly more chaotic.
this whole video comes down to "I can't be bothered to know about C++, let me make a 17 min long video malding about how Python overtook me cuz I can write complex classes but can't use std::move"
rust is simpler then c++ but is just as fast mmm it could of been simple from the start 1:56
"rust is simpler than* c++"
yeah, sure buddy, keep dreaming
aaaaaaaaaaaa why is youtube pushing sh*tty AI-generated French audio translation tracks by default please mr. video tell me that you can turn that stuff off 🫣