I am not sorry for switching to C

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 568

  • @gabrielfougeron6007
    @gabrielfougeron6007 10 วันที่ผ่านมา +1011

    I can't tell whether you realize this or not, but the product of two symmetric matrices is not (in general) a symmetric matrix. The bottom formula at 4:36 is wrong. It is however true that the product of two symmetric matrices that commute is a symmetric matrix, which is why the approach works in practice. Great project though, keep up the good work 🙂

    • @SheafificationOfG
      @SheafificationOfG  10 วันที่ผ่านมา +967

      hahahahahahaha omg
      the day I stop making videos with embarrassing errors is the day I stop making videos

    • @monochr0m
      @monochr0m 10 วันที่ผ่านมา +83

      @@SheafificationOfGyou are a silly goober, I appreciate you

    • @gabrielfougeron6007
      @gabrielfougeron6007 10 วันที่ผ่านมา +101

      😂 I only noticed because of how much I've made this very mistake myself.

    • @98danielray
      @98danielray 10 วันที่ผ่านมา +48

      it also makes the diagram wrong :sadge

    • @DusanFajler
      @DusanFajler 10 วันที่ผ่านมา +19

      @@SheafificationOfG Beaten again :)

  • @sharpch4026
    @sharpch4026 10 วันที่ผ่านมา +773

    The level of dedication towards Fibonachi numbers is crazy, horrifying even

    • @siquod
      @siquod 10 วันที่ผ่านมา +18

      Reminds me of the time I solved the game where in their turn the players need to flip two adjacent pluses to minuses in a sequence. I wrote ridiculous parallelized fast-Fourier based bitset convolutions, only to realize that the answers became periodic, and then to learn about the Sprague-Grundy theorem. It was a good nerd snipe.

    • @bigzigtv706
      @bigzigtv706 10 วันที่ผ่านมา +9

      @@siquodme when i eat chocolate squares

    • @Alan-zf2tt
      @Alan-zf2tt 10 วันที่ผ่านมา +4

      @@siquod I would not feel so bad. Everything becomes periodic eventually in computers - even randomness

    • @esphix
      @esphix 10 วันที่ผ่านมา

      ​@@bigzigtv706chomp chomp

  • @MaakaSakuranbo
    @MaakaSakuranbo 7 วันที่ผ่านมา +76

    The job interviewer asking you "So how would you implement a Fibonacci calculation" is not ready for the answer

    • @klobiforpresident2254
      @klobiforpresident2254 3 วันที่ผ่านมา +5

      "The interview is only scheduled for half an hour. Maybe I can get through this faster with a flip chart."

  • @KuiperContact
    @KuiperContact 9 วันที่ผ่านมา +509

    I cannot believe well optimized smart C code is faster than poorly optimized naive C++

    • @SuperGauravgautam
      @SuperGauravgautam 9 วันที่ผ่านมา +29

      cope

    • @andrewporter1868
      @andrewporter1868 9 วันที่ผ่านมา +25

      He forgot to use smart pointers. That was the whole problem.

    • @thezipcreator
      @thezipcreator 9 วันที่ผ่านมา +10

      @@andrewporter1868 I don't even think smart pointers was the problem; it was memory copying

    • @andrewporter1868
      @andrewporter1868 9 วันที่ผ่านมา +4

      @@thezipcreator Well no he was using naive pointers; and naive pointers are initialized with what they assume you wanted before you finish talking.

    • @rheinhart1721
      @rheinhart1721 9 วันที่ผ่านมา +26

      Genuinely the reason I prefer C over C++ is because I find it easier to write good C than good C++. Even if writing C requires more effort to do basic tasks, at least it keeps me from making lazy and costly decisions.

  • @optimumisbad
    @optimumisbad 10 วันที่ผ่านมา +387

    At this rate it's going to be the Gibonacci sequence.

    • @Kaizzer
      @Kaizzer 8 วันที่ผ่านมา +1

      Gibbonacci

    • @aarondcmedia9585
      @aarondcmedia9585 7 วันที่ผ่านมา

      @@Kaizzer yes given the monkeys in the video this seemed a more complete expression of the continuation.

  • @darqed
    @darqed 10 วันที่ผ่านมา +1024

    you say you're not a c++ compiler but you're literally called g++ (a compiler for c++)

    • @evanev7
      @evanev7 10 วันที่ผ่านมา +70

      he makes that joke at 2:50 lmao

    • @evanev7
      @evanev7 10 วันที่ผ่านมา +61

      oh my god i got owned nvm

    • @jmvr
      @jmvr 10 วันที่ผ่านมา +45

      No, he's (g+)+, the parentheses matter

    • @RayCodes
      @RayCodes 10 วันที่ผ่านมา +19

      @@jmvr No, it doesn't. You multiply the + so it's g++.

    • @swordofthemorning777
      @swordofthemorning777 10 วันที่ผ่านมา +11

      10:31

  • @tompov227
    @tompov227 10 วันที่ผ่านมา +386

    Every one of this videos has a lot of funny things but inside the video somewhere is an absolute banger of a meme. For this video it was "Look at how they mangled _ZN2my3boyE"

    • @tokarak
      @tokarak 9 วันที่ผ่านมา +8

      That meme was also in a previous video in this series!

    • @Alceste_
      @Alceste_ 9 วันที่ผ่านมา +2

      I fully agree and you'd have my like if the counter wasn't already at such a nice(tm) value. Here, take my comment instead.

    • @Davsan1
      @Davsan1 9 วันที่ผ่านมา +5

      What's the joke?

    • @RandomlyAwesomeGamer
      @RandomlyAwesomeGamer 9 วันที่ผ่านมา

      @@Davsan1 C++ function name mangling

    • @tokarak
      @tokarak 9 วันที่ผ่านมา +21

      @@Davsan1 A lot of compilers “mangle” named functions into a unique identifier which looks like that, and is obviously not as human-readable. The original Godfather quote is “look how they massacred my boy.”

  • @CatDistributionSystem
    @CatDistributionSystem 10 วันที่ผ่านมา +58

    Your videos are incredible and the density of interesting and funny points exceeds anything I've encountered on TH-cam before. Keep it up!

  • @mage3690
    @mage3690 9 วันที่ผ่านมา +109

    This entire video should be reference material at every uni course in existence, IMHO. "I'm just taking cheap shots at the hidden coefficient in the big-O" was damn near a _refrain_ . . . and yet, your algorithm became faster to a hilarious degree. Goes to show you that "the hidden coefficient" ain't hidden when it gets run on silicon.

  • @alilseman2979
    @alilseman2979 7 วันที่ผ่านมา +8

    It sure can be hard to be imperfect these days. Your humility and light heartedness are a breath of fresh air, not to mention that it can a lot easier to follow along with someone learning than someone teaching. I appreciate this for many reasons on multiple levels. I watched the first video the other day too. This is good content. I’m delighted and inspired, and the funny thing is that I barely care about the topic, but I’m hooked on the attitude. Keep it up, dude.

  • @PatrikHolub-v1p
    @PatrikHolub-v1p 6 วันที่ผ่านมา +4

    I absolutely love your style of videos. Just the right amount of humor, technicality and useful information. Please keep doing more.

  • @MyriadColorsCM
    @MyriadColorsCM 9 วันที่ผ่านมา +20

    4:59 - Its been...10 years, since I last hear this sound.
    I miss you Frank.
    Cool video!

  • @Czeckie
    @Czeckie 9 วันที่ผ่านมา +149

    'I am a mathematician, I always feel stupid.' goes hard

  • @AllanSavolainen
    @AllanSavolainen 10 วันที่ผ่านมา +305

    There is a much better way, just set the main() to be constexpr and the compiler will calculate the numbers in advance, the runtime will be super fast and continue until it breaks when the interger values overflow.

    • @kippers12isOG
      @kippers12isOG 9 วันที่ผ่านมา +31

      Damn, he worked it out

    • @theultimateevil3430
      @theultimateevil3430 9 วันที่ผ่านมา +37

      You're about to discover a world of slow as fuck memory access, with optimizations that do extra work on CPU just to save on those reads

    • @T3sl4
      @T3sl4 9 วันที่ผ่านมา +94

      Coming soon to a Stack Exchange near you "how to tell the OS to optimize loading a 2GB executable"

    • @Mat-rv3ez
      @Mat-rv3ez 9 วันที่ผ่านมา +12

      The 4,000,000th fibonacci number takes up 350kB. That is just one number. Numbers this big are stored as an array so it can’t overflow.

    • @matthieurochette
      @matthieurochette 8 วันที่ผ่านมา +2

      @@T3sl4 Hey, loading the executable in memory is not technically the same as executing it's contents :P

  • @fibbooo1123
    @fibbooo1123 10 วันที่ผ่านมา +11

    You make such clever wordplay that still leads to such informative videos, thank you!

  • @amos9274
    @amos9274 10 วันที่ผ่านมา +13

    I have been casually programming for years and am an graduating in EE now, but videos like yours really make me want to get deeper into maths! Like I'm genuinely considering getting a math degree, just so I can learn how to abuse objects and numbers like you guys do.

  • @sarevoker
    @sarevoker 10 วันที่ผ่านมา +4

    Subscribed, humble man, and if attacked my many is a good clue of people who tries to improve over those who think are themselves ultimate genius.

  • @ADRIANO782
    @ADRIANO782 9 วันที่ผ่านมา +7

    This is the nth time I'm checking what sheafification means and going into a topology rabbit hole, I hope you're happy 😉 (great videos btw)

  • @lack7773
    @lack7773 10 วันที่ผ่านมา +9

    You are one of my favorite channels, always good and funny!

  • @plopsmcgee9672
    @plopsmcgee9672 9 วันที่ผ่านมา +5

    1:18 This is a brilliant lesson on constructing more hurtful insults. More people should be aware of this!

  • @Androidonator
    @Androidonator 9 วันที่ผ่านมา +104

    Yeah mom i am watching sheafication of G pretending to understand what he is saying.
    It's like reading books when I couldn't read and looking only for the pictures.

    • @DrPeeper
      @DrPeeper 9 วันที่ผ่านมา +5

      You misspelled the name.

  • @YesIAmBlessed
    @YesIAmBlessed 10 วันที่ผ่านมา +19

    I love this style of educational content so much.
    informationally dense + memes + self-depracating humor = i like, i subscribe

  • @dinhero21
    @dinhero21 10 วันที่ผ่านมา +9

    11:01 omg that joke is SO GOOD
    (the one FAN propelling you upwards despite the drag)

    • @rtg_onefourtwoeightfiveseven
      @rtg_onefourtwoeightfiveseven 9 วันที่ผ่านมา +2

      Every time I watch a (g+)+ video I eagerly await the "...I'll always have one fan at my back" gag variation, and every time it does not disappoint.

  • @equivocator7727
    @equivocator7727 8 วันที่ผ่านมา +6

    What I appreciate about this video is that it goes to show that with modern hardware, that hidden constant can change so much from one implementation to another. For so many common scales, big O is almost useless, and even for the scales where big O is very important, that secret hidden constant remains VERY relevant.

  • @sentel140
    @sentel140 9 วันที่ผ่านมา +2

    honestly I have been learning way more about c++ from your videos than most other tutorials and in my classes

  • @NejakejTomas
    @NejakejTomas 10 วันที่ผ่านมา +84

    1:54 - one thing to note - with the introduction of the debug statements, therefore custom (copy/move)constructors / (copy/move) assignment operators, the number is no longer "trivially copyable" (`std::is_trivially_copyable` will return false for it) if the `number` was before, and the compiler can't do a lot of optimizations anymore. Looking at assembly (with optimizations) when there are not the debug constructors / operators, the compiler won't even put the values into a memory, they will stay in registers and the copy/move is just mov instruction for trivially copyable types.
    And as someone who wrote (basic) compiler and studies compiler design: any at least a little bit reasonable compiler with turned on optimizations will "know" that the `tmp` is no longer used and will optimize it.
    And it goes even further, because even tho the assembly of the code has some mov instructions, these are in a lot of cases not even executed due to register renaming inside the CPU and are effectively no-op.
    Edit: try to compile it with clang if you are not using it already, LLVM is more modern and can vectorize code way better than GCC

    • @von_nobody
      @von_nobody 10 วันที่ผ่านมา +8

      "can vectorize code way better than GCC" this is not always the case, for some programs GCC is faster.

    • @NejakejTomas
      @NejakejTomas 10 วันที่ผ่านมา +12

      @@von_nobody For some that's true, but generally LLVM is better. But it's always better to just try and benchmark the result

    • @von_nobody
      @von_nobody 10 วันที่ผ่านมา +2

      @@NejakejTomas yup

    • @viliml2763
      @viliml2763 9 วันที่ผ่านมา +4

      `number` is a bignum struct, which is not trivially copyable

    • @sunofabeach9424
      @sunofabeach9424 9 วันที่ผ่านมา

      ​@@von_nobodyunder very rare circumstances like running on L*nux

  • @urban248
    @urban248 10 วันที่ผ่านมา +20

    I found your channel today's morning, watching this exact video, computing fibonacci numbers. I subscribed because your humor is top notch. Now you drop this. What in the matrix does youtube know?

  • @miguelborges7913
    @miguelborges7913 10 วันที่ผ่านมา +35

    Math person doing programming not in Haskell?!?!?!?!?!

  • @michaelzumpano7318
    @michaelzumpano7318 8 วันที่ผ่านมา

    Good job. I subscribed! This is what programming is all about! It’s what it’s always been about, behind the curtain. And it has literally been forgotten by most of us.

  • @trwn87
    @trwn87 9 วันที่ผ่านมา +4

    You’ve outdone yourself with this one and I can’t wait to break the gold medalist once and for all!

  • @RedstonekPL
    @RedstonekPL 10 วันที่ผ่านมา +88

    we shall welcome a new (C)had to our c community

    • @Iuigi_t
      @Iuigi_t 10 วันที่ผ่านมา +17

      You mean (c)ommunity?

    • @RedstonekPL
      @RedstonekPL 10 วันที่ผ่านมา

      @Iuigi_t the (c)ult

    • @sunofabeach9424
      @sunofabeach9424 9 วันที่ผ่านมา

      ​@Iuigi_t (C)gfault community

  • @lauraramsey1415
    @lauraramsey1415 9 วันที่ผ่านมา +32

    This guy has the voice of CGP Grey, the skills of 3B1B, and the personality of Samonella Academy. Perfection.

  • @lolmanthecat
    @lolmanthecat 9 วันที่ผ่านมา +18

    1:13 "Unfortunately for them, I am a mathematician: I always feel stupid." I FELT THAT IN MY CORE!

  • @Stone_624
    @Stone_624 9 วันที่ผ่านมา +5

    This is Awesome. Never be sorry for using C. And how you stepped through your improvements here is inspiring. Way to go!

  • @petriksacha
    @petriksacha 9 วันที่ผ่านมา

    I just love the way your videos combine math, programming, and humor, keep it up!

  • @jaralara6429
    @jaralara6429 9 วันที่ผ่านมา

    I literally watched the previous video two days ago and was expecting a follow-up by the end of the year XD Can't wait to watch this one

  • @acemuffins3840
    @acemuffins3840 10 วันที่ผ่านมา +57

    Watching this as a fourth year comp sci student and... wow
    I really wanna get on your level in programming, both C and C++

    • @shadow-ht5gk
      @shadow-ht5gk 10 วันที่ผ่านมา +20

      He’s a math major btw haha

    • @Urien_n
      @Urien_n 10 วันที่ผ่านมา +35

      This is the wrong person to be looking up to

    • @VioletRM
      @VioletRM 10 วันที่ผ่านมา +5

      i mean, hes very good at math

    • @nikkiofthevalley
      @nikkiofthevalley 10 วันที่ผ่านมา +8

      He's good at math. Significantly less good at programming.

    • @rockets4kids
      @rockets4kids 10 วันที่ผ่านมา +17

      Code maintenance is what you really want to be studying. There was a time when people hand-coded in assembly for speed, but these days compilers can often do a better job, especially for CPUs where maintaining the pipeline is important. When going for speed, what you should be doing is looking at the code the compiler generates, and then seeing if you can improve upon it. Needless to say, you only want to do this *after* you have profiled your code to see what parts of it are actually hogging up the CPU.

  • @petrsokol588
    @petrsokol588 10 วันที่ผ่านมา +29

    Great video, I would like you to consider moving some of the text higher above the bottom edge, since it's hidden behind subtitles and cannot be read.

  • @bartolhrg7609
    @bartolhrg7609 10 วันที่ผ่านมา +15

    3rd video about this. It's like you are making Fibonacci series.

    • @netmonk
      @netmonk 8 วันที่ผ่านมา +6

      This one is the sum of the two last vidéos

  • @bunniesarecute3135
    @bunniesarecute3135 10 วันที่ผ่านมา +11

    I gotta say, i'm a burly looking man in my mid 20s and I giggled in excitment when I saw your video pop up in my feed, then proceeded to run home so I could watch it

  • @matijagavranovic747
    @matijagavranovic747 9 วันที่ผ่านมา +1

    High high tier wind pun this video. I hope the streak continues!

  • @solanofelicio
    @solanofelicio 10 วันที่ผ่านมา +3

    Quality video as always, adjoint of adjoint of g

  • @nousernameleft999
    @nousernameleft999 9 วันที่ผ่านมา

    truly excellent. excited for the eventual culmination, imagine the gold trophy but with all the jumps taken out

  • @sobertillnoon
    @sobertillnoon 9 วันที่ผ่านมา +1

    Your comment section reminds me a lot of all the students in my comp sci classes in college round 1.

    • @gnikdroy
      @gnikdroy 9 วันที่ผ่านมา

      In a good way, or a bad way?

    • @sobertillnoon
      @sobertillnoon 9 วันที่ผ่านมา

      @gnikdroy to clarify, I meant the comments he showed on screen. I've not delved into the comments myself. So in a bad way but probably not factually.

  • @himitsumonban
    @himitsumonban 9 วันที่ผ่านมา

    this channel deserves more subscribers

  • @rtg_onefourtwoeightfiveseven
    @rtg_onefourtwoeightfiveseven 10 วันที่ผ่านมา +13

    2:50 got me good.
    10:13 Sonic might be able to break the speed limit of C++, but can he break the speed limit of finite numbers?

    • @SheafificationOfG
      @SheafificationOfG  10 วันที่ผ่านมา +4

      ayyy we got a real one here 👊

  • @jamppa-87-1
    @jamppa-87-1 8 วันที่ผ่านมา

    Nice video! Like the theme!

  • @cosmnik472
    @cosmnik472 10 วันที่ผ่านมา +5

    8:04 727 real
    I converted that to decimal in my head and i am unreasonably proud of that :3

    • @stymlice2332
      @stymlice2332 9 วันที่ผ่านมา

      You should memorize it as binary

    • @zanilis
      @zanilis 2 วันที่ผ่านมา

      I'M SO GLAD I'M NOT THE ONLY ONE TO GET THAT ONE

  • @maaikevreugdemaker9210
    @maaikevreugdemaker9210 9 วันที่ผ่านมา +1

    Omg I love when stuff like 4:50 happens. I am always so interested din non standard operators. Like the 'clay' addition operator where 1+1=1.

  • @AlexMax2742
    @AlexMax2742 9 วันที่ผ่านมา +37

    Every developer who cares about their craft owes it to themselves to know C. You don't have to use C on a regular basis, you don't even have to like the language, but knowing C has the highest amount of payoff in the world of computing, measured in terms of how many doors it unlocks and how many obscure things it makes clear.

    • @thezipcreator
      @thezipcreator 9 วันที่ผ่านมา +10

      eh, kind of. C does not actually really represent what's going on in your computer. If anything, C is sort of holding us back; we keep designing computers so they emulate the C virtual machine when other ways of writing programs would be faster.
      read the article "C Is Not a Low-level Language: Your computer is not a fast PDP-11" by David Chisnall if you're curious

    • @apprenticerocker9885
      @apprenticerocker9885 9 วันที่ผ่านมา

      I agree, wish to have learned C and the main Linux/Unix system calls earlier instead of wasting too much of my time with React

    • @giorgiannicartamancini3917
      @giorgiannicartamancini3917 9 วันที่ผ่านมา +2

      ​@@thezipcreator That was super interesting, thanks for the recommendation!

    • @voliol8070
      @voliol8070 9 วันที่ผ่านมา

      @thezipcreator thanks for the recommendation, good reading!

    • @wilsonbotlero2363
      @wilsonbotlero2363 8 วันที่ผ่านมา

      Lmao. It's like telling every developer who cares about their craft to learn assembly.

  • @ferinzz
    @ferinzz 7 วันที่ผ่านมา +1

    The math went way over my head, but I do know one thing : if I hear exponent or log I hear bitshift. Powerful AF. Fast AF.
    I have a 32x32x32 bitmap that resolves almost entirely by using bitshifts. It feels glorious.

  • @jamscone_
    @jamscone_ 9 วันที่ผ่านมา +3

    7:58 literal tears i cant escape it

  • @hopejohn
    @hopejohn 6 วันที่ผ่านมา

    "Unfortunately for them, I'm a mathematician: I always feel stupid." Instant subscription.

  • @Xnoob545
    @Xnoob545 9 วันที่ผ่านมา +2

    10:14 THAT'S THE GOODSTEIN SEQUENCE THING!

  • @derex47
    @derex47 9 วันที่ผ่านมา

    the mad man is back at it again

  • @muskyoxes
    @muskyoxes 10 วันที่ผ่านมา +41

    "Do i think i can make optimizations better than a C compiler?" Apparently you can make them better than a C++ compiler

  • @captheobbyist6434
    @captheobbyist6434 6 วันที่ผ่านมา

    you're so skilled
    PLEASE make the gold medalist from c++ video but in c. i wonder how much better the result will be.

  • @Alcaline-hu2vu
    @Alcaline-hu2vu 10 วันที่ผ่านมา +14

    As a self-taught programmer and HS senior, I have no fucking clue what's going on here, I just know that big number make brain happy

    • @dangeristh33
      @dangeristh33 9 วันที่ผ่านมา +4

      As a self-taught programmer and Physics Bsc and math minor, I have no fucking clue what’s going on here, I just know that big number make brain happy

    • @fitmotheyap
      @fitmotheyap 9 วันที่ผ่านมา +3

      Self taught programmer and all I can say is
      Too much spent on optimization and it's scary. But optimization makes me happy

  • @maxmustermann5590
    @maxmustermann5590 9 วันที่ผ่านมา +1

    Babe wake up a shefification video dropped

  • @geekjackson
    @geekjackson 8 วันที่ผ่านมา +6

    Not sure about Python, but Julia can hit the 34,000,000th Fibonacci number in a second with 10 lines of code...
    using StaticArrays: SA
    function fib(n::UInt)
    n_bits = 8 * sizeof(UInt) - leading_zeros(n)
    A = SA{BigInt}[1 1; 1 0]
    B = SA{BigInt}[1; 0]
    for i in 0 : n_bits - 1
    B = iszero((n >> i) & 0b1) ? B : A * B
    A = A^2
    end
    return B[1]
    end

  • @moniduh0
    @moniduh0 9 วันที่ผ่านมา

    great video, keep them coming

  • @tamirthenoscopertamir224
    @tamirthenoscopertamir224 9 วันที่ผ่านมา

    i like the editing style

  • @lukasjetu9776
    @lukasjetu9776 9 วันที่ผ่านมา

    That video description made me literally 'LOL'

  • @MathTech83
    @MathTech83 6 วันที่ผ่านมา

    “I’m a mathematician, I always feel stupid. “ I feel seen.

  • @kodirovsshik
    @kodirovsshik 10 วันที่ผ่านมา

    Absolutely love your videos.

  • @esphix
    @esphix 10 วันที่ผ่านมา

    A g++ vid always makes my day

  • @simonedeiana2696
    @simonedeiana2696 10 วันที่ผ่านมา +22

    I am not Corry for Cwitching to C

  • @white_145
    @white_145 10 วันที่ผ่านมา +2

    wow this guy really likes fibbonaci numbers

  • @RichardLofty
    @RichardLofty 4 วันที่ผ่านมา +1

    You can compute fibs in 3 distinct ways.
    Everything else is just a waste of time.
    Recursive. Procedural. Array.

  • @Il_panda
    @Il_panda 9 วันที่ผ่านมา +1

    if you really want to end this on top, you have build a custom ASICs to run your matrixes in, and the just cut power to everything except the memory and you have your number

  • @blinded6502
    @blinded6502 9 วันที่ผ่านมา

    Symmetric matrix can be thought of as an operation, that resizes vector space. 3x3 symmetric matrix has 3 orthogonal directions that it non-uniformly scales, each direction being an eigen-vector of a matrix. Hence product of two symmetric matrices can be a rotation/skew matrix (combination of two reflections (negative scaling along some axis) yields a rotation).

  • @catcatcatcatcatcatcatcatcatca
    @catcatcatcatcatcatcatcatcatca 10 วันที่ผ่านมา +8

    I am. beginner and the code at 1:53 illustrates why C++ feels like a nightmare compared both C and python.
    In C, I will probably leak memory, but it is usually pretty easy to see why. Without inheritance or generic types, leaking memory is easy and, outside of simple programs, managing it is tideous, but I don’t write complex programs.
    In Python, I don’t need to care. The interpeter is unreasonably fast despite the OOP hierarchy all symbols in the language has. My assumption is that it is a slow language because of my indifference to performance, but sometimes it manages to be really fast despite the sinfull disregard I show towards CAS latency, memory bandwidth and the finite nature of SDRAM.

    • @geuros
      @geuros 10 วันที่ผ่านมา +1

      Do you know Cython?

    • @toby9999
      @toby9999 10 วันที่ผ่านมา +3

      You don't have to write C++ code that way. I never do it. I just pick features I want or need. I've been a C and C++ developer for 30+ years. Pretty much all C++98 with a tiny bit of C++14.
      I don't understand why people bash a language because it has features they dont need or want. That would be like hating on a car because it has an extra good toolkit and advanced car audio.
      I like C, but it lacks some of the features I want. C++ has too many features, whilst C lacks what it needs to be an efficient all-rounder. C is great, but it's niche.
      You can also use C++ in a C style. Pointer arithmetic works the same way, as do C arrays, and you can leak memory. You're in charge.
      The biggest difference fir me is that C++ has containers. A simplistic example...
      C
      char temp[256];
      strcpy(temp, "Hello ");
      strcat(temp, "World");
      C++
      string temp;
      temp = "Hello ";
      temp += "World";

    • @isodoubIet
      @isodoubIet 10 วันที่ผ่านมา +1

      Either the language is complicated or your program is complicated. With C++ I learn it once and then all my programs have a shot at being simple. In C, anything nontrivial will be hopelessly complicated.

    • @volbla
      @volbla 7 วันที่ผ่านมา

      ​@@toby9999 _"C++ has too many features, whilst C lacks what it needs to be an efficient all-rounder."_
      Maybe you should try one of the newer low level options like Zig or Odin. I've been learning a bit of Odin, and its approach to memory management is super neat. It also comes with some common data structures, like maps and dynamic arrays, built in.

  • @toodths
    @toodths 7 วันที่ผ่านมา

    programming community try not to be insufferable challange, amazing video!

  • @nekoill
    @nekoill 6 วันที่ผ่านมา

    I can't see a single reason why you should feel sorry for switching to C. It's a great and powerful language. It has been around for a while, and it will still be around when the last man draws his last breath, because there's no decent other way to write a performant software. Good on you.

  • @JesseRubingh-i8u
    @JesseRubingh-i8u 9 วันที่ผ่านมา

    Crazy Fibsonicci fast go big

  • @anon5334
    @anon5334 8 วันที่ผ่านมา

    Maan, you got my respect

  • @artey6671
    @artey6671 22 ชั่วโมงที่ผ่านมา

    I didn't understand everything, but I recently implemented a standard exponentiation algorithm and I had to decide whether to start at the most or least significant bit. I chose the former, which apparently was the right choice.

  • @mrlarrydapuppet4337
    @mrlarrydapuppet4337 9 วันที่ผ่านมา +1

    8:05 I never thought I’d have a WYSI moment in binary

  • @dimchen99
    @dimchen99 10 วันที่ผ่านมา

    it's like im watching an anime
    waiting for a villain arc

  • @someguy7576
    @someguy7576 9 วันที่ผ่านมา +2

    C++: does it all. Good at none of it.

  • @seasong7655
    @seasong7655 10 วันที่ผ่านมา +1

    Very impressive optimizations. Maybe this should be added as a python library.

    • @Db_BW
      @Db_BW 10 วันที่ผ่านมา +1

      Python/Pythonistas grabbing everything into their repertoire!

  • @LlwisRoberts
    @LlwisRoberts 10 วันที่ผ่านมา +33

    try it in fortran, I think the language was designed for stuff like this in mind.

    • @wayhip
      @wayhip 10 วันที่ผ่านมา +2

      the optimizing compilers are supposed to be better as well.

    • @playerguy2
      @playerguy2 9 วันที่ผ่านมา

      I'd suggest Octave, but we're talking about g++, not gfortran.

    • @nerdycatgamer
      @nerdycatgamer 9 วันที่ผ่านมา +4

      well written fortran could most likely be faster than c for this application, but he would run into the same issue he ran into with c++. he most likely can't write good enough fortran to get it better than c

    • @wayhip
      @wayhip 7 วันที่ผ่านมา +1

      @ nothing can saves us from bad programmers. Every attempt to eliminate them with new languages, frameworks, and methodologys has just developed a new crop of bad programmers who are bad in new and interesting ways.

  • @JamesACTaylor
    @JamesACTaylor 9 วันที่ผ่านมา +2

    4:58 We miss you, Papa Frank

  • @lixianan
    @lixianan 4 วันที่ผ่านมา

    I would get my joke out now, but letting it become irrelevant first in later videos feels like a fitting sendoff to c++

  • @anhkiettran7123
    @anhkiettran7123 10 วันที่ผ่านมา +8

    Hello! This is great. Actually, this method isn't new; it can be seen in the CORDIC system.
    On the subject of computation, I call this method the famous quote of Thanos: "break down to the atoms." Algebra is also used in ODE.

  • @ScaleShift
    @ScaleShift 22 ชั่วโมงที่ผ่านมา

    This is _fantastic_

  • @Letmechangethisplease
    @Letmechangethisplease 9 วันที่ผ่านมา

    The speed at which I clicked on this.

  • @veaxvoid
    @veaxvoid 9 วันที่ผ่านมา

    cant wait for next part

  • @oglothenerd
    @oglothenerd 10 วันที่ผ่านมา +5

    The timing is pretty funny. I recently started choosing C over Rust for whatever reason! C is really captivating, and I don't know why! (It isn't the simplicity, C should at least have namespaces.)

    • @Alcaline-hu2vu
      @Alcaline-hu2vu 10 วันที่ผ่านมา

      Every line of C code can be roughly translated to one line of assembly, which means that C gives you absolute control to do whatever the fuck you want as long as the actual CPU is capable of doing it
      What this means is that you get to do some absolute black magic fuckery to squeeze some last bits of performance out of the CPU

    • @chri-k
      @chri-k 10 วันที่ผ่านมา +4

      Once you begin to C you won't want to stop C

    • @nicholasgoat
      @nicholasgoat 9 วันที่ผ่านมา +3

      rust is a psyop language

    • @nerdycatgamer
      @nerdycatgamer 9 วันที่ผ่านมา +1

      you can hack in namespaces with static structs and function pointers :p

    • @sunofabeach9424
      @sunofabeach9424 9 วันที่ผ่านมา +2

      Rust isn't about speed though it's about safety and automatic memory management without gc or reference counting

  • @arnaudparan1419
    @arnaudparan1419 9 วันที่ผ่านมา +6

    There are custom matrix multiplication instructions in x86_64 so you might be interested in those and doing some inline assembly.
    Personally when I have the choice between C++ and assembly I write assembly. C++ is just way too confusing and modern C is just straightforward. It even has stuff like _Generic.

    • @thezipcreator
      @thezipcreator 9 วันที่ผ่านมา +1

      C++ is just a horribly designed language; like any other systems programming language is better

    • @blinded6502
      @blinded6502 9 วันที่ผ่านมา

      @@thezipcreator BeefLang is better alternative. It looks almost like good old C#.

  • @yoyoyogames9527
    @yoyoyogames9527 9 วันที่ผ่านมา

    the obi wan category theory one had me rolling fuckkk

  • @greatnate29
    @greatnate29 8 วันที่ผ่านมา +4

    I do believe you can make more optimized assembly then a C compiler. Its not that hard to do because while the C compiler is very good at what it does, it isnt psychic and needs to work for every situation not just yours. You on the other hand can write code knowing exactly what it can and cant do. Like you can even see what the compiler does and just optimize it by hand if uou want. Its the best of both worlds.

    • @volbla
      @volbla 7 วันที่ผ่านมา +1

      Theoretically yes, but that means you have to know all the options available in the assembly for your architecture. Who has time for that? 🫠

    • @greatnate29
      @greatnate29 7 วันที่ผ่านมา

      @volbla I mean you don't need to know everything. Some instructions are just significantly less common and useful then others. That being said you are right, writing assembly is just more tedious and time consuming. Like you can write in assembly but most people don't want to for good reasons.

    • @volbla
      @volbla 7 วันที่ผ่านมา

      @@greatnate29 For sure. On the other hand, Casey Muratori claims assembly is easier to learn than CSS, so idk.

  • @gandalfgrey91
    @gandalfgrey91 8 วันที่ผ่านมา

    He’s speaking english, but I still want to say “genau” whenever he explains something.

  • @ilxplay
    @ilxplay วันที่ผ่านมา

    That's definitely a skillset that will bring you very far💀

  • @gregorymccoy6797
    @gregorymccoy6797 6 วันที่ผ่านมา +1

    8 more watches and I'm well on my way to understanding half the information.

  • @hebozhe
    @hebozhe 9 วันที่ผ่านมา

    In case you're curious, "平方求幂" means "exponentiation by squaring".

  • @sharp8185
    @sharp8185 3 วันที่ผ่านมา

    8:04 this was maybe the last video id expect a wysi joke in

  • @DerMatheman
    @DerMatheman 7 วันที่ผ่านมา

    Heres the mathematical formular for the nth fibonaci number
    Runtime = 0.0000001 sec
    Fn = (1/√5) * ((1 - √5)/2)^(n+2) * ((1 + √5)/2) - (1/√5) * ((1 + √5)/2)^(n+2) * ((1 - √5)/2)

  • @kruksog
    @kruksog 9 วันที่ผ่านมา

    1:12 Amazing clap back. Too real, too true.

  • @moe_31415
    @moe_31415 10 วันที่ผ่านมา

    I love your content