This is a really easy question to answer. C++ is way faster. Python is interpreted, so unless you write all the code in native code in a library you call from Python, the performance won't be anywhere close. Also, python being interpreted isn't only making it slow because it has to figure out what to do rune by line every time, but also because it has to do a lot of extra stuff just to do the same. For example, to do a simple add in C++ it takes 1 assembly instruction, while in Python it takes 181 assembly instructions. (Numbers taken from Casey Muratori's Computer Enhance series) Though you could make C++ just as slow, but that would require you to write code that is really slow (for example by heavily using the OOP aspect of C++), and does a lot of unnecessary things.
@jerichaux92197 ай бұрын
I honestly doubt that you could even intentionally write C++ to perform as slow as Python. Nothing against Python, it was my first language ever (as it has been for so many), but it has its use-cases and its limitations. Writing a quick-script in Python, leveraging the many available modules written by the community, is often-times a charm compared to writing an equivalent C++ program. But, of course, C++ dominates in terms of performance and control (you can’t get much more close to the metal unless you start raw-dogging assembly), and in my opinion maintainability (even with type-hints, Python can quickly become a mess to manage as it grows in scale). It is, as is so often the case, about choosing the right tool for the job.
@AserenesnowАй бұрын
"Your content is highly engaging and informative, I appreciate your efforts. Please continue sharing such valuable resources."
@NatxoVarona7 ай бұрын
Un gran video NICK y gracias por la comparacion, seguire programando ciertos programas en c++ y otros en Python
@diegoaredes27218 ай бұрын
Wow what difference, nice video.
@AndyFaber7 ай бұрын
Very informative. Thanks a lot!
@siupa238 ай бұрын
What about python with raylib ?
@StarFury27 ай бұрын
It wouldn't make a difference. It's not the fault of the graphic library, but core python. As John Carmack said - if you care about performance, you simply can't use 'for' loops in python. Excellent modules like Numpy or JITs can provide workarounds, but you'll constantly pay hefty performance toll for initial ease of use of Python.
@정하은-h6s7 ай бұрын
Great video Nick!
@GabrielBigardi7 ай бұрын
Please make a comparison with Bevy as others suggested, it will be really interesting.
@mrdixioner7 ай бұрын
I'm wondering why the Python developers made this language so slow? What prevented them from making it an order of magnitude faster? Python could be divided into two possibilities: compiled (for fast and demanding tasks) and interpreted (for scripts, WEB and other development). Regarding the comparison: I would like to know the difference in performance between C++ and C#.
@rondeau_choysky66637 ай бұрын
Interesting. It would be good to know the ram comsumption. I am making a visual novel with SDL c++ and I am wondering if it is better to use renpy
@RenderingUser7 ай бұрын
I think renpy will be better for basically every reason. Python isn't slow when it comes to something as simple as a visual novel. Renpy also comes built in with useful visual novel features like save files and resource handling and the ability to export easily to all platforms. I don't think you need a compiled language for a visual novel.
@diegoaredes27217 ай бұрын
@@RenderingUser i agree.
@alessandrorossi12946 ай бұрын
Why C++ and raylib vs Python and Pygame? Why not C++ and raylib vs Python and raylib?
@AndyFaber7 ай бұрын
Btw, have you thought about a raylib game tutorial for a 2-player game equipped with an AI player, like Tic-tac-toe with the minimax algorithm for training the AI?
@SebastianHasch7 ай бұрын
You don't even need an AI that sophisticated for tic-tac-toe. There is an optimal way to play where you never lose. If that's too boring just let it make random moves 30% of the time ;)
@AndyFaber7 ай бұрын
Sure, but the idea was rather to focus on a simple game AI based on tree algorithms. Tic-tac-toe is indeed too simple. On the other hand, many known games are really complex and overkill for a tutorial. I don't know about Othello, though. Maybe it's a good example if the board isn't too big.
@SebastianHasch7 ай бұрын
@@AndyFaber True. I guess in this case tic tac toe really is the best option👍
@AKG58Z29 күн бұрын
Same video with different game i have seen it already and it's good