Why is Python 150X slower than C?

Поділитися
Вставка
  • Опубліковано 31 гру 2024

КОМЕНТАРІ • 295

  • @yashkhd1100
    @yashkhd1100 Місяць тому +184

    it's dam simple thing why it C type languages runs faster.
    => Don't want to harm anyone's feelings but originally Python was created for "Power users" i.e. people who wanna play around with things here and there. It was never meant to b full blown development language. Due to it's ease of use purpose people started use it everywhere.
    -> Python is Interpreted so when you run it compiles and execute the code.
    ->Python is tapeless/dynamic typed that means at runtime it will keep checking for which type of variable it is.
    => Being C/C++ system languages it has mammoth amount of optimization from Compilers and optimizers like LLVM toolchain. A experienced c/c++ dev can even make it run more faster by using specific compiler flags when compiling C/C++.

    • @knowledgedose1956
      @knowledgedose1956 Місяць тому +7

      python is not typeless, it is strictly typed and dynamic typed language.

    • @yashkhd1100
      @yashkhd1100 Місяць тому +4

      @@knowledgedose1956 Well theoratically it's typed but it just doesn't help to improve runtime performance. The interpreter keeps track of type but because type can change dynamically...it can't do much.

    • @cristianoo2
      @cristianoo2 Місяць тому

      ​@@knowledgedose1956wrong. Python is typeless. You can declare a var, put an int on it then put a string on it and the language will accept that.

    • @cristianoo2
      @cristianoo2 Місяць тому +3

      ​@@knowledgedose1956sure you can hint the interpreter that you will pass a certain type, but the interpreter still accepts other types. Thus, it is not typed at all.
      I've never studied it under the hood but I bet it uses some sort of void pointer and meta information accepting anything that comes from the user and using an algorithm to determine how to deal with the void pointer using the meta information.

    • @knowledgedose1956
      @knowledgedose1956 Місяць тому +2

      @cristianoo2 it is typed. if an object doesn't have method, you won't be able to call it. yes, you probably will understand this later than needed, unless you use typechecking, but python has types. it is just not compiled language.

  • @luminsky
    @luminsky Місяць тому +67

    iirc, the reason you were getting 0s in C was because the OS sets memory to 0 for security reasons. for example if you close Chrome, you wouldn't want some other program to be able to read your bookmarks from memory.

    • @comradepeter87
      @comradepeter87 Місяць тому +6

      That is correct. But, the garbage data could still happen say, when you've called a function, it pushes its elements on the stack, and then when it returns your local variables are pushed in the same overlapping region. Then, the 'dead' data from that function would still be reflected here.

    • @dragonloverlord
      @dragonloverlord Місяць тому +2

      ​@@comradepeter87 this pretty much and let's not forget the possibility of other programs not handling garbage collection of miss managing memory as that could also result in "oddities" anyways I've always said hope for the best but prepare for the worst and C seems to be pretty good at proving why it's important to prepare for things to go wrong as no matter how fool proof or secure an OS may claim to be there will always be another fun oopsie moment sooner or later.

    • @souptime1554
      @souptime1554 17 днів тому +1

      I believe it is also categorized as undefined behavior, so the C standard doesn’t say what should happen if you use an uninitialized value, meaning it could be entirely up to the compiler or operating system.

    • @samconnelly7630
      @samconnelly7630 День тому +1

      On Linux systems, whenever you request a page of memory from the kernel, it is always zeroed out before you get it, unless your kernel was compiled with the CONFIG_MMAP_ALLOW_UNINITIALIZED option AND you specify MAP_UNINITIALIZED in the flags argument to mmap.

    • @dragonloverlord
      @dragonloverlord 15 годин тому +1

      @samconnelly7630 That's a good point! I had actually forgotten about the whole different systems have different base standards aspect of things so if you give a C language example that works fine on Linux (and is valid in a standard use case scenario) it could be insecure or even unstable on another system if not properly adapted by the viewer which if I'm being honest I can't really imagine many people are going to consider such details aside from actual dedicated/career programmers that is.

  • @anshupandey6260
    @anshupandey6260 Місяць тому +9

    In python 3.13 they introduced JIT within the language and performance for cpu Bound task will increase in future version of python.

  • @volodumurkalunyak4651
    @volodumurkalunyak4651 Місяць тому +30

    6:36 No. Your code IS direcly running on the CPU (or GPU/NPU). It is running is Ring 3 mode - it has to call OS for allocating RAM, storage acsess, or talking to somewhere (other processes or network).

    • @codedamn
      @codedamn  Місяць тому +11

      exactly. obviously your code has to run on CPU but it cannot bypass OS. ring 3 IS part of your operating system. kernel IS part of your operating system

    • @volodumurkalunyak4651
      @volodumurkalunyak4651 Місяць тому +5

      @codedamn and there is a mistake in the video saying "code doesnt run direcly on the CPU" when it clearly does. Mistake at 6:36.

    • @matthiasbendewald1803
      @matthiasbendewald1803 Місяць тому +6

      @@codedamn ring 3 is the user-mode, has to do with what the CPU will allow the software to do. Doesn't have to do with the OS itself, all programs run on the CPU directly. What do you even mean by "it cannot bypass OS"? The OS can't execute programs, only the CPU can. The CPU cares for all the details, assigning Memory allocations, file access and even stopping/interrupting the program. So there is nothing to bypass, it's quite the opposite: The OS will start the program, which will then run directly on the CPU.

  • @RustedCroaker
    @RustedCroaker Місяць тому +72

    The most satisfying thing in the test is the fact Java perform almost as good as C and Rust.

    • @AyushVachhani
      @AyushVachhani Місяць тому +13

      Then the tests are flawed lop

    • @RustedCroaker
      @RustedCroaker Місяць тому +20

      @@AyushVachhani No, that means modern Java JIT is technological marvel that can beat any AOT with ease

    • @comradepeter87
      @comradepeter87 Місяць тому +17

      @@RustedCroaker Nope, these microbenchmarks are very flawed in general. The main thing that'd impact Java's performance in the real world isn't its ability to JIT such a simple hot-loop, it's the garbage collection and the large amount of memory pressure that Java applications exert on the host system.

    • @AyushVachhani
      @AyushVachhani Місяць тому +2

      @@RustedCroaker I agree that Jit is really great ( I myself use it ), but I will be honest, I have spent a lot of time on systems programming ( the code can be optimised a lot, like for example verterization, enabling agressive loop unrolling, passing release mode compiler flags, building for machine specific using compiler flags again ).
      I don't mean to say that java is bad, it's just that C is always going to faster ( assuming the person writing knows every inch of C ).

    • @AyushVachhani
      @AyushVachhani Місяць тому +1

      @@RustedCroaker Also trust me, the optimized version could run a lot faster than java ( no hate to java again )

  • @SiddharthPant
    @SiddharthPant Місяць тому +7

    There is PR in repo which enables JIT for PHP and it gains some ground by reducing till 2.6s instead of 9.9s shown.

    • @MelroyvandenBerg
      @MelroyvandenBerg Місяць тому

      Yea that is nice. I also have php jit enabled.

  • @JitendraSingh-lr4nu
    @JitendraSingh-lr4nu Місяць тому +250

    Okay but I am still gonna use Python.
    edit : Y'all boomers need to chill as if Python is the only language I know. I have used Java, C++ and JavaScript too. Language is just a syntax when you know the basic concepts.

    • @DebdutBiswasOnline
      @DebdutBiswasOnline Місяць тому +9

      😂 me too

    • @Sandeep-zd6dq
      @Sandeep-zd6dq Місяць тому +8

      We are even using it because of it’s simplicity 😢😂

    • @thekokoserver
      @thekokoserver Місяць тому +8

      I choose it all day 😂

    • @davidrich27
      @davidrich27 Місяць тому +26

      As long as you aren’t writing a program that requires a billion nested loop iterations.

    • @_vk03
      @_vk03 Місяць тому +1

      I wished he would have tested mojo too.

  • @comradepeter87
    @comradepeter87 Місяць тому +22

    Can I just say that looking at more and more Indian developers, I had gotten jaded at our industry as it was very rare where I found developers that would actually care about what's going underneath the layers of abstraction or know about it. As a consequence, there's so much knowledge gap that people are not aware of.
    BUT, after watching this channel and reading the comment section here, I'm glad to say that it's not all developers and some indian devs do actually care to go in depth and to all of you, I respect you. I wish I had more fellow devs like you I could chat to, it's topics like these that are actually fascinating and not what's the next framework.

    • @KeshariPiyush24
      @KeshariPiyush24 Місяць тому

      Really enjoying the insights in this thread! It’s awesome to see so many like-minded people here. Hope we can keep the conversation going and exchange ideas!

    • @paca3107
      @paca3107 28 днів тому

      this kind of lazy devs ai will replace first

  • @jeffg4686
    @jeffg4686 Місяць тому +3

    a lot of libraries for python are implemented in other languages though, like Rust, so the user code will be slow, but not always the library code.

  • @comradepeter87
    @comradepeter87 Місяць тому +15

    It's a bit misleading to say that userland applications "don't run on the CPU". They DIRECTLY, NATIVELY run their machine code on the CPU. There is no translation happening on-the-fly or otherwise by the OS except at startup by the OS' loader which might resolve .so/DLL dependencies (yes, not even virtual address mapping). It's better to think of OS as a bunch of "dead"/inactive code that CPU is responsible for invoking/calling on specific triggers/interrupts. If OS actually actively participated in your code execution every cycle, nothing would ever get done.

    • @KeshariPiyush24
      @KeshariPiyush24 Місяць тому

      Better to put it in this way, our user application just translates to op-codes and system calls when we need to access hardware/network etc.
      When we need to do something that is outside the scope of our program we raise an interrupt. Now OS handles all the interrupts and toggles the user/kernel mode flags in CPU if some restricted tasks needs to be performed.
      SO basically our program at interrupts just calls some code/function that is the part of the os and is handled directly by the OS and not the program. Obviously this is done to enhance security.

    • @Chief_Avy
      @Chief_Avy 29 днів тому

      @@KeshariPiyush24 Hi i found your know remarkable can u kind of guide me how can i study/ gain exposure to this kind of knowledge .

    • @KeshariPiyush24
      @KeshariPiyush24 28 днів тому

      @@Chief_Avy I have a degree in Computer Science so I have studied about how OS and CPUs works in my college as well. All the best keep learning and growing 😊

  • @AllMightGaming-AMG
    @AllMightGaming-AMG Місяць тому +17

    The way you explained how operating system sits between your code and the CPU is misleading. Your code directly runs on the CPU, but it runs on user mode. The operating system manages the MMU so that the times when your program is scheduled, it is not allowed to access memory outside of the allocated region.

    • @codedamn
      @codedamn  Місяць тому +5

      It’s a simplified explanation and just to invoke curiosity. I can cover everything in depth and it will become a 2 hour video

    • @AllMightGaming-AMG
      @AllMightGaming-AMG Місяць тому +6

      @codedamn true, but that simplification should be pointed out, because the video explanation makes it look like your program is running on a vm, not on the cpu directly.

    • @codedamn
      @codedamn  Місяць тому +1

      @@AllMightGaming-AMG the program has to run on CPU at the end (where else would it run), even on a VM, underlying physical core is responsible for running your computer. to your statement, "user mode" and "kernel mode" are constructs defined by your OS. your physical CPU core does not know/care about permissions

    • @AllMightGaming-AMG
      @AllMightGaming-AMG Місяць тому +10

      @@codedamn Hey, the CPU does know about user mode and kernel mode, it is a bit set in the cpu itself. It is fine if you didn't know this but I'm surprised that you'd say this without doing your own research, it's just a search away.

    • @AllMightGaming-AMG
      @AllMightGaming-AMG Місяць тому +2

      @@codedamn it'd be impossible to write secure os where the user mode application is able to access anything without a hardware feature like a kernel mode flag. OS alone can't do this. A lot of microcontrollers are there without this feature, and you can't write an os with this kind of user mode application feature on them because of this reason.

  • @isenksaja5333
    @isenksaja5333 22 дні тому +2

    python very friendly for observer (teacher or trainer or non professional coder) to read code.
    very expensive for real or production system, just like performance ratio from this video title, at least when on production, using c we only need 1 server, but using python we need 150 server for same output

  • @KeshariPiyush24
    @KeshariPiyush24 Місяць тому +1

    Really enjoying the insights in this thread! It’s awesome to see so many like-minded people here. Hope we can keep the conversation going and exchange ideas!

  • @venkatmanian2256
    @venkatmanian2256 Місяць тому +1

    Lot of the delay is due to the OS. Any round robin scheduler will only allow a slice of the CPU time (to create the illusion of servicing all other open tasks/application). This exacerbates the slow down for interpreted languages (Since a pre-compiled binary can be executed in the slice of time the OS provides to the app). Try running this on an embedded micro with an RT OS. I tried it on a Peta Linux running on a Xilinx SOC(ZCU 104) and the difference is not that bad. But I understand for people working on old Batch processing/ Round robin OS like windows this might be an issue.

  • @heliumcloudgaming182
    @heliumcloudgaming182 28 днів тому +2

    Only Native Codes (Rust , C , C++) Compiled into Assembly then binary. Vm languages Uses Jit , Aot or Normal Iteration.

    • @mattmmilli8287
      @mattmmilli8287 21 день тому

      JavaScript should be slow as Python or slower in this bucket. They go way way beyond JIT. V8 optimizes the living heck out of the code as well in deeeeep ways. I bet Python could have this too

  • @cmdr_scotty
    @cmdr_scotty Місяць тому +5

    This is what I've been telling everyone, yes python is faster to throw a program together, BUT it's very unoptimized in comparison to C/C++

    • @Aditya-p4t
      @Aditya-p4t 25 днів тому

      u can increase python speed using PYPY

    • @cmdr_scotty
      @cmdr_scotty 25 днів тому

      @Aditya-p4t you shouldn't need to install additional modules to make a coding language faster that has inherent issues running fast

    • @hemanthkumar5438
      @hemanthkumar5438 23 дні тому +2

      You have to differentiate the use cases here. Python is usually used for running something like web framework where the bottle neck is I/o.
      And C is run for something like device drivers and encoder/decoders which run billions of loops the bottle neck is CPU itself.
      In simpler language you don't need to spend hours to write a C program to spend 0.001 seconds in execution and 100ms waiting for I/o. While you can spend minutes writing a python code that will execute in 0.1 ms and wait 100 ms for I/o.
      So both have their use cases.

  • @luizgrocco
    @luizgrocco Місяць тому +10

    The fact PyPy is 3x slower than C and Python is 150x speaks volumes about Python despite everything you explained wouldn't you say?

  • @bhushanlaware
    @bhushanlaware Місяць тому +5

    All HLL have guardrails including Java and Javascript however they are not that slow.
    The main reason I guess python is being interpreted language. Javascript is also interpreted language however due to JIT compiler and v8 engines optimisation make it faster. Pypy is JIT for python which as very close performance to javascript as we can see in experiment. But for normal python environment since it’s completely being interpreted line by line it’s slow

  • @enricmm85
    @enricmm85 18 днів тому +1

    Where is assembly?

  • @hemanthkumar5438
    @hemanthkumar5438 23 дні тому

    I have seen that graphic before, and i thought it was some fallacy, as i myself had done similar comparisons in past.
    Your explanation makes sense.

  • @tusharphb6596
    @tusharphb6596 Місяць тому +4

    Getting addicted to this channel

  • @Watch-Kiran
    @Watch-Kiran Місяць тому +4

    So I'm maglu(jo jaadu na jane) in this language and all
    That means stable diffusion was written in c language rather than python it could be faster?

    • @Mayank-lf2ym
      @Mayank-lf2ym Місяць тому

      No

    • @Watch-Kiran
      @Watch-Kiran Місяць тому

      @Mayank-lf2ym ok

    • @nirbhaykumarchaubey8777
      @nirbhaykumarchaubey8777 Місяць тому

      @@Watch-Kiran yes

    • @comradepeter87
      @comradepeter87 Місяць тому +1

      Not really, most of the actual inference/ML libraries have actual core performant part written in C anyways. The performance impact would not be big enough.

    • @Watch-Kiran
      @Watch-Kiran Місяць тому

      @@comradepeter87 thank you

  • @Takatou__Yogiri
    @Takatou__Yogiri Місяць тому +2

    JS/Bun, JS/Node, and JS/Deno - we are definitely going to see more JavaScript runtimes in the future. We might even see compiled JavaScript, offering a flavor similar to compiled languages. The syntax would remain the same, but the compiler would handle the code differently from how the V8 engine does. like a true compiled language.

    • @comradepeter87
      @comradepeter87 Місяць тому +2

      It'd be very complex to create a truly compiled (AOT) JS version while still being 100% spec compliant. Immediately what stands out to me are functions like `exec()` that execute a JS string. An obvious shortcut would be spin up a JS compiler that, at runtime, compiles that JS string. But that string could have variables referencing the exact current state of your own program, so this compiler now needs to tap into your program state as well. Probably not impossible, but difficult enough to be impractical - especially because JS' JIT is very impressive anyways.

    • @Takatou__Yogiri
      @Takatou__Yogiri Місяць тому

      @VivekYadav-ds8oz it might be complicated. But it's not impossible. Js ecosystem is very large. And someone might be insane enough to start the project 😶

    • @KeshariPiyush24
      @KeshariPiyush24 Місяць тому +1

      @@Takatou__Yogiri how would a weakly typed dynamic programming language such as Javascript be compiled AOT? The best we can get is JIT which is already there. Maybe we can do that for Typescript though

  • @iWillAvert
    @iWillAvert 19 днів тому

    Python's slowness is especially interesting when you consider that it's not just an interpreted language. It is a VM similar to Java. The only real difference is that the bytecode is not precompiled to a file and run through the VM separately. That in itself can contribute to some of the slowdown, but still does not account for how slow it is at the end of the day.
    I might be talking out of my ass as I am not 100% sure at the time of writing this, but I would guess that it is does multiple passes during compilation to bytecode. This has a lot of advantages, but it is also significantly slower. That would again not fully explain it. Factoring in what I've mentioned, it should at least be up there with JS or even Kotlin.
    There is definitely a lot more to the story as this test is not the only one where you can see such a significant difference in speed between Python and even other scripting languages/VMs.

  • @abymohanan9403
    @abymohanan9403 Місяць тому +1

    3:29 what software you using to write and draw in this video, please tell me

  • @hareTom
    @hareTom 28 днів тому

    Except syscalls, native code runs directly on CPU
    memory access are handled from the OS

  • @Sandeep-zd6dq
    @Sandeep-zd6dq Місяць тому +1

    I guess in C int variables has 0 as the default value (not a garbage value) so it also has some guardrails but yeah it’s possible that assembly instruction for C might be less compare to other languages and most of complied languages can opt in to have less guardrails as they already do a lot of checks prior to conversion and awesome video as always.

    • @AyushVachhani
      @AyushVachhani Місяць тому +1

      Default is garbage, not 0

    • @comradepeter87
      @comradepeter87 Місяць тому +2

      I don't think that "0" part is because of C as it doesn't offer any such guarantees. It's just the OS clearing any memory to 0 before giving it to the userland application. You can verify this by first calling a function that allocates a ton of stack variables with arbitrary values and then returns out. Then, in the main function, you allocate some uninitialised integers on the stack and print their values. I bet this time they would have non-zero values.

  • @timur.shhhhh
    @timur.shhhhh 23 дні тому +2

    this is a very incorrect comparison, maybe the code does the same thing, but the implementation is bad:
    1. c/c++ is first compiled and then executed, while py/js is executed as it is implemented.
    2. Python uses methods: range and random, which greatly slows down the program, especially randint

  • @ykmnkmi
    @ykmnkmi 23 дні тому

    Additional 4 chars places Dart near C.

  • @netron66
    @netron66 27 днів тому

    If that is the case would it be faster if using ai to convert all the python to c be something can be done to "optimise" a software back script?

  • @pwhv
    @pwhv Місяць тому +1

    where is c#?

  • @maddada
    @maddada Місяць тому

    Very intrigued by "static hermes" and how much it would speed up JS code.

  • @tomjerry0796
    @tomjerry0796 Місяць тому +2

    At the end of this video "I'll see you in the next video very soon"😂 that is tomorrow daily one video 🔥🎉

  • @ammarahmed7566
    @ammarahmed7566 Місяць тому

    we are doing course of data science and our instructor just told that R language is slower than Python however we see a difference here

    • @Aditya-p4t
      @Aditya-p4t 25 днів тому

      u can increase python speed

    • @ammarahmed7566
      @ammarahmed7566 25 днів тому

      @@Aditya-p4t yes, its just a language there are many gpu accelerated workloads like cuDF , cuPy, Dask-cuDF, PyTorch and TensorFlow (with GPU acceleration) etc. that is why python is preferred in data science (however bend programming language can be significantly faster as it is based on C)

  • @mattmmilli8287
    @mattmmilli8287 21 день тому

    The fact JS is that high up there is a modern miracle. Google really went hard with v8 way back when now 😮

  • @TrongNguyen-lq8gd
    @TrongNguyen-lq8gd 24 дні тому

    Java is crazy speed for a managed code platform

  • @hexarium4817
    @hexarium4817 23 дні тому

    Dynamic Types dont slow the language as much as u think

  • @picklenickil
    @picklenickil Місяць тому

    IntrEsting.. Mehul Bhai... Entrusting is something else

  • @rretro2042
    @rretro2042 8 днів тому

    Wow Java being only 8% slower that rust and c in this case is what surprised me the most here

  • @kyesil
    @kyesil Місяць тому +4

    Python best for using. Not for production.

    • @Aditya-p4t
      @Aditya-p4t 25 днів тому

      i maybe wrong but we can increase the python speed

    • @scratch-9097
      @scratch-9097 24 дні тому

      OpenAI uses FastAPI for their ChatGPT Backend

  • @owaisahmed2063
    @owaisahmed2063 Місяць тому

    Good one. Please also create an in depth video that explains everything from code to compiler etc then assembly , op code OS , CPU etc.

    • @codedamn
      @codedamn  Місяць тому +3

      Most people won’t be interested in watching that

    • @owaisahmed2063
      @owaisahmed2063 Місяць тому

      @@codedamn may be you can create part 1 and see the response. but it will be worth it as such contents are rare

  • @shubhamdhameliya4756
    @shubhamdhameliya4756 Місяць тому +1

    There is llvm step and it will optimise lots of things

  • @humtohchutiyehai1016
    @humtohchutiyehai1016 Місяць тому +2

    So isn't python better than cpp if it is making sure that everything is correct at runtime as we can detect error early?And i only use cpp for dsa so i dont know much in details but i heard neetcode say that cpp is much much more than what we use regularly for dsa ,is it this stuff he was talking about like in big companies the developer define everything by themselves but for language like js it is pre defined ( i dont know much about python)

    • @AyushVachhani
      @AyushVachhani Місяць тому +1

      Cpp is low level, and the cpp used to software development is completely different from the one you use in DSA

    • @comradepeter87
      @comradepeter87 Місяць тому +4

      Language scope for C++ is incredibly insane. I stopped moments after learning about "concepts" (an actual term, basically similar to traits in Rust) when I saw what's more to come. Learning about STL and templating would get you far enough, but learning the entire language is incredibly difficult. I'd wager to say there's less than 10 people in the whole world that understand all the ins-and-outs of C++ in every edge case.

    • @Axel_Andersen
      @Axel_Andersen Місяць тому

      @@comradepeter87 Yeah. I knew C inside and out to the minute details so I thought I'd do the same with C++. Nope. Never. And that was 20 years ago, now the language is an order of magnitude more complex. Yes, you can comfortably use it without knowing it all but I would prefer to understand it all.

    • @Axel_Andersen
      @Axel_Andersen Місяць тому +1

      @@AyushVachhani I think it is totally wrong to call C++ low lever, on the contrary.

    • @AyushVachhani
      @AyushVachhani Місяць тому

      @@Axel_Andersen I am talking relative to Java. Else even C is high level, only binary and assembly would be lower level.

  • @white_d3vil
    @white_d3vil Місяць тому

    Don't blame it 😢 like this, it's definitely gonna improve in future

    • @MelroyvandenBerg
      @MelroyvandenBerg Місяць тому

      With jit it will improve. Both php and python.

  • @ALOKSHARMAMD
    @ALOKSHARMAMD Місяць тому

    thats why you dont use python in production but use mojo or something else.

  • @mayankhacker1
    @mayankhacker1 Місяць тому

    What about c#

  • @Luix
    @Luix 24 дні тому

    How can be Java way faster than Go?

  • @mateonikolic6984
    @mateonikolic6984 21 день тому

    Java ftw.
    You get a built in gc. Nice syntaxes, easy to understand beautiful language and still fast af

  • @M0h1tKum4r
    @M0h1tKum4r Місяць тому

    I feel pity for those who compares languages based on their execution speed.Every language has it's own pros and cons, they will not talk about how fast the development becomes while using python but all they want is to ask their c++/rust doubts using pyhton built LLMs

    • @electronnuclear
      @electronnuclear 16 днів тому

      Those python built LLMs have AI libraries written in low level languages like C. All the matrix operations and stuff are handled by the C code. Python only makes the necessary function call. The reason you can do fast development in python is bcz of having vast majority of libraries that already does most of your job. You're right about the rest.

  • @sanjaybhatikar
    @sanjaybhatikar 20 днів тому

    Python is most loveable but code in whatever works for you and enjoy ❤

  • @vinayak2450
    @vinayak2450 20 днів тому

    Where is swift

  • @curtis1397
    @curtis1397 16 днів тому

    Seems like it must be a very specific pitfall. Why would most of the ai packages use python if it's so slow?

  • @oboynitro
    @oboynitro 19 днів тому

    node is just c++
    the sooner you understand that the better

  • @mayankbhaisora2699
    @mayankbhaisora2699 Місяць тому

    Where is Swift?

  • @roccociccone597
    @roccociccone597 17 днів тому

    I guarantee you that nothing running on the JVM is that close to native speed. Every time I have compared the JVM to Go or Rust it loses.

  • @gto433
    @gto433 Місяць тому +6

    Disappointed to see no C#

    • @husreihn1070
      @husreihn1070 Місяць тому +2

      c# is faster then java tho

    • @imakhlaqXD
      @imakhlaqXD Місяць тому

      ​@@husreihn1070 i don't think so i have used both and their architecture is almost similar with jit and vms. So i don't think their will br any difference.

    • @RustedCroaker
      @RustedCroaker Місяць тому +1

      @@husreihn1070 It's a bit slower actually. Similar to Kotlin.

    • @sanampakuwal
      @sanampakuwal Місяць тому +2

      ​@@imakhlaqXDyou're so uneducated for the topic, and writing comment blindly

    • @sk_jay
      @sk_jay Місяць тому +1

      I think it will be similar to Java if not better

  • @thanatosor
    @thanatosor 20 днів тому

    Where is Zig

  • @urname-animator
    @urname-animator 28 днів тому

    wheres asm?

  • @drswapnil1234
    @drswapnil1234 6 днів тому

    Then why is python defacto for machine learning? Noob here

  • @v1Broadcaster
    @v1Broadcaster 15 днів тому

    150x is magnitudes fastest than it was a few years ago

  • @arvnd619
    @arvnd619 Місяць тому +2

    Bro, rather than the subject, I love and admire the way you speak English fluently and clearly, I just enjoy that.....

  • @pritishranjan
    @pritishranjan Місяць тому

    Yes python is really slow! Thats why libs like Pandas are written in C under the hood. Sometimes i is a tool. It makes you develop things faster than any language. I love it.

  • @AslamNazeerShaikh
    @AslamNazeerShaikh Місяць тому +1

    C# is better than all the shit langs showed in video 🎉

  • @gardnmi
    @gardnmi 22 дні тому

    Python is probably the fastest at adding value.

  • @MiebakaIwarri
    @MiebakaIwarri 29 днів тому

    I'm very sure I won't be conventinally running a billion iteration in production

    • @hardtech1010
      @hardtech1010 25 днів тому

      No you are mistaken. Every request from your user creates an iteration even packages you use have some kind of looping and iterations going on. Yes you can easily hit a billion iteration in prod.

    • @MiebakaIwarri
      @MiebakaIwarri 23 дні тому

      @hardtech1010 like I said, I won't be running a billion iteration conventinally, if the server or any package installed cares do it that's it's own.

  • @sagarchakraborty007
    @sagarchakraborty007 17 днів тому

    Those extra 74 seconds you have spend writing the code in C😂

  • @krishnasonawane6664
    @krishnasonawane6664 20 днів тому

    Eh, it makes up for the slower speed with faster development time

  • @Yukiixs
    @Yukiixs 24 дні тому

    Java faster than go?? Suprising, even quarkus is a slower microservice framework than builtin golang, not even talking about spring

  • @imranhussain8700
    @imranhussain8700 Місяць тому +1

    C# is missing :(

    • @RustedCroaker
      @RustedCroaker Місяць тому

      Nobody likes Microsoft

    • @imranhussain8700
      @imranhussain8700 Місяць тому

      @RustedCroaker Sad. But is it true?
      There are lots of enhancements improvementa in Microsoft World.

    • @smtkumar007
      @smtkumar007 Місяць тому

      i tested it the performance is just below go at 0.78s

    • @imranhussain8700
      @imranhussain8700 Місяць тому

      @@smtkumar007 you can send a pull request to that github repo

  • @kaplansedat
    @kaplansedat Місяць тому +3

    .net ?

    • @Ctrl_Alt_Elite
      @Ctrl_Alt_Elite Місяць тому

      I dont even code in C# but was also curious where it would place here

    • @imakhlaqXD
      @imakhlaqXD Місяць тому

      Its gonna be same level as java they have mostly similar architecture with jit and vms.

    • @kaplansedat
      @kaplansedat Місяць тому

      @@imakhlaqXD native aot

    • @sanampakuwal
      @sanampakuwal Місяць тому +1

      ​@@imakhlaqXDnop you're still on past

  • @martinsanchez-hw4fi
    @martinsanchez-hw4fi 24 дні тому

    Dont see Julia there

  • @sanjaybhatikar
    @sanjaybhatikar 20 днів тому

    Homo Sapiens is 100 times slower than Cheetah

  • @aabhishek4911
    @aabhishek4911 Місяць тому +1

    The code does not get converted to ASM . Assembly is a separate language itself.

    • @Chat_De_Ratatoing
      @Chat_De_Ratatoing Місяць тому

      compilation converts code to ASM to a binary. You can avoid the compile to a binary step adding -S like this:
      gcc file.c -S -o file.S

    • @comradepeter87
      @comradepeter87 Місяць тому +1

      @@Chat_De_Ratatoing I recently learned that most modern compilers (including LLVM) just generate machine code directly from their IR. So, it's actually the opposite.
      Compilation converts code to binary. You can add the compilation to assembly by adding -S like this:
      gcc file.c -S -o file.S

    • @johnpekkala6941
      @johnpekkala6941 Місяць тому

      C/C++ compilation are multiple steps including ASM. There are 5 to 6 steps in total including compiling, optimization, assembler and linking. These all happen at compile time however and so don't affect execution speed whatsoever. The actual program execution is done on pure binary machine code (.bin or .exe) wich is one of the main reasons i think behind the blazing speed of languages like C/C++ and Rust. These many steps are however why languages like C and C++ in contrast to the fast execution speed instead takes forever to compile. This is seen clearly when using game engines like Unity and Unreal Engine. Higher level languages like Unity C# and Unreal Blueprint have fewer compile steps but more execution steps so they compile much faster but execute slower because they don't compile right down to machine code so extra steps are needed then during the execution. In contrast Unreal C++ is blazing fast to run but it takes between 10 - 20 minutes each time to compile. Also however C++ is an old language and I heard somwhere that much of the long compile time is because the compiler reads each file like 100000000000000 times during compilation to see if anything has changed. More modern low level languages like Rust don't do that and so compile faster.

    • @Axel_Andersen
      @Axel_Andersen Місяць тому

      @@johnpekkala6941 You are, I think, right on the money why C++ takes forever to compile. The language semantics pretty much force the compiler to read and parse and stuff the same files over and over again. This is the main reason I abandoned C++ years ago. The insane compile times. Plus the way people avoid using name spaces and spell out everything std::xxx::yyy instead of writing code that concentrates on the actual thing being done. And the corner cases of the language do not help either.

    • @hemanthkumar5438
      @hemanthkumar5438 23 дні тому

      Yes it does.

  • @emmanuelatikese3645
    @emmanuelatikese3645 Місяць тому

    Don't worry gophers they didn't use go routine

  • @AlmirBispo-CSV-Comp-DB
    @AlmirBispo-CSV-Comp-DB Місяць тому

    Put pascal on the test too

  • @charlesabju907
    @charlesabju907 21 день тому

    No way Java is that much faster than Go

  • @favouronwuchekwa
    @favouronwuchekwa 18 днів тому

    Ruby is faster than python?😢

  • @marcuss.abildskov7175
    @marcuss.abildskov7175 Місяць тому

    I'm still flabbergasted that Python is used for data science / machine learning 😂

    • @JamilKhan-hk1wl
      @JamilKhan-hk1wl Місяць тому +1

      Only as the wrapper. Most of the framework is written in C

  • @user-eg3ft4hi8j
    @user-eg3ft4hi8j Місяць тому

    simple answer , because of GIL Lock , that will not let you use full power of multiprocessing. Also , C is closer to processor commands , that no one else , except assembly.

  • @mathijs9365
    @mathijs9365 18 днів тому

    Python is developed for easy programming not speed.

  • @DK-ym9zv
    @DK-ym9zv 29 днів тому

    Python is for shell scripts. Its easily to write shell scripts in python than real shell scripts. Period stop using it for backend and stuffs

  • @Serizon_
    @Serizon_ Місяць тому +1

    Very interesting to see bun being equal-ish to golang in these loops and kotlin beating golang.
    I guess the point of golang is simplicity. which I appreciate.
    I would've liked a lua benchmark

    • @kevinnadar6077
      @kevinnadar6077 Місяць тому

      Its really surprising to see go having similar speeds to JS/Bun...
      And the fact that Java/Kotlin beating them is even more astounding
      I guess I have the wrong notion regarding golang, thinking that it will slightly slower speeds than Rust

    • @bardeebooboo
      @bardeebooboo Місяць тому

      @@kevinnadar6077 but go is still good in low memory environment

  • @davidkroods811
    @davidkroods811 25 днів тому

    Wtf no c#

  • @raph151515
    @raph151515 Місяць тому

    I thought Python was overall thousands of times slower than C

    • @AyushVachhani
      @AyushVachhani Місяць тому

      What world do you live in 😂

    • @raph151515
      @raph151515 Місяць тому

      @@AyushVachhani in some use case it's true, just that the test you are referring to isn't the worst case.

    • @AyushVachhani
      @AyushVachhani Місяць тому

      @@raph151515 lol, then what's the worse case, am genuinely interested to know

    • @raph151515
      @raph151515 Місяць тому

      @@AyushVachhani the most syntax volume and memory allocation/GC possible per iteration. I don't know if python will progressively optimize like the modern JS engine do or keep interpreting and I wonder about the hard limits of its GC. I'm not saying that the language is wrong, I know it's used in performance context like in AI but because it's barely scripting/orchestrating native binaries doing the heavy lifting. In the optics of testing the language, I don't know if we can use the best use case if their point is to rely on native binaries. The equivalent for JS would be to test it using c code compiled in WASM, it wouldn't make sense as a valid JS entry.

  • @MahirArinLabib
    @MahirArinLabib 16 днів тому

    replace t with d to sound indian

  • @hellelo.5840
    @hellelo.5840 Місяць тому

    JVM faster than Go doesn't make sense

  • @sonessz
    @sonessz 25 днів тому

    ok. who cares? Its only the 5020503205th video talking about speed of languages.

  • @akasjoe
    @akasjoe Місяць тому

  • @saikatdutta1991
    @saikatdutta1991 Місяць тому

    What's the point of running a simple loop and benchmark 😂... In real world you will never be writting simple loop only.. if this was the only job of a language then all these languages wouldn't have been invented.. each language has it's own usecases, solves difference types of problems,
    One language would be enough in that case.😊

  • @rubyciide5542
    @rubyciide5542 Місяць тому +1

    Bruh js being faster than python lmao 💀💀💀

    • @mrmadhan8557
      @mrmadhan8557 Місяць тому +1

      Js is always faster than python. Python is a shit

    • @comradepeter87
      @comradepeter87 Місяць тому +1

      I don't know who fed this to you, but JS is surprisingly fast - miles ahead of Python. V8 is an incredible piece of engineering and I recommend more people to read/watch content on it. Just check how V8 handles strings (it's not a simple vector of bytes).

  • @WalterWhite-yk5fn
    @WalterWhite-yk5fn Місяць тому +31

    Python is overrated

    • @koder_k14
      @koder_k14 Місяць тому +2

      🤧 ohh really?

    • @Rxlochan
      @Rxlochan Місяць тому +9

      Said mostly by people who haven’t written python and shipped it to production

    • @RustedCroaker
      @RustedCroaker Місяць тому +2

      @@Rxlochan Said by people who force others to use this garbage in production

    • @Rxlochan
      @Rxlochan Місяць тому +1

      @@RustedCroaker What No one is forcing anyone to write only in python

    • @NightDay1
      @NightDay1 Місяць тому

      Everyone before I learn python : it's the best language ever.
      Everyone now : Python is trash☠️

  • @timmygilbert4102
    @timmygilbert4102 Місяць тому

    Cython😂

  • @MG-yc6jr
    @MG-yc6jr 18 днів тому

    All this python is slow talk is bullshit. Programming languages are tools made to do different things efficiently . You want to write something to be very fast and resource efficient go with c, c++ or rust . You want to make a backend of a website quickly go for python , php or something else . These tools are there for us to choose and use them according to our requirement. If we are writing the backend of a site in c and site has 2 visitors per day then we are just wasting our time

  • @john-schumandr
    @john-schumandr 27 днів тому

    acha bhai

  • @albincr
    @albincr Місяць тому

    Kotlin is faster than Golang lol😂😂😂😂😂

    • @KeshariPiyush24
      @KeshariPiyush24 Місяць тому

      why not this is just one aspect. When we say some language x is faster than language y, it doesn't necessary means that all the things will be 100% faster in x than y. Some things could be faster in y even though generally it is slower language in average compare to x.

    • @albincr
      @albincr Місяць тому

      @@KeshariPiyush24 lol

    • @KeshariPiyush24
      @KeshariPiyush24 Місяць тому

      @@albincr yeah keep doing LOL on everything....... I guess you have ostrich syndrome.......LOL 🤡🤡🤡🤡

  • @nodistractionsjustgoandstu1842
    @nodistractionsjustgoandstu1842 Місяць тому

    Let's go

  • @guilherme5094
    @guilherme5094 Місяць тому

    👍

  • @joshuasanders4302
    @joshuasanders4302 Місяць тому

    What an absolutely useless test lol... God benchmarks like this are so dumb. And I say this as a C++ SWE.

  • @zungaloca
    @zungaloca 25 днів тому

    Interpreted languages suckkkkll

  • @TheMathues123
    @TheMathues123 29 днів тому

    Python is 150x slower than C, but you are 35000x slower with C than with Python.