why my scripting language is already faster than python

preview_player
Показать описание
python uses a stack based virtual machine.
my language is register based. that's why it is faster.
this video explains what that means.

chapters:
0:00 - intro
0:10 - demo
0:26 - performance
1:23 - how python works
2:35 - register machines
3:55 - conclusion
Рекомендации по теме
Комментарии
Автор

note: it's supposed to illustrate the idea, not be realistic/fast.

leddoo
Автор

Considering most computationally intensive jobs in python are done via specialized libraries written in assembly and C, getting python faster is probably not required as it will cause a massive overhaul to the architecture of the language.

swarnavasamanta
Автор

Funny enough, this is almost exactly what I am doing (and comparing it to), with my own custom language! Nice work!

austinmajeski
Автор

The stack is at times easy, and at times difficult to understand. Your animations are so simple, yet so elegant on whats happening. great job!

TheSkepticSkwerl
Автор

This is an incredibly well-done video. Keep up the good work my friend!

WhatDidILearn
Автор

The stack animations are crazy awesome. Such effective teaching

ProjectileGrommet
Автор

As someone who didn't understand what a stack was coming into this, you did a great job at explaining it. Loved the animation.

ujkyujhrbdfgjy
Автор

More than stack machine the correct term imo is a "stack based virtual machine". Also, imo the term "bytecode" is not correctly used, for me that "intermediary" code would be more like assembly specially designed to run on the python virtual machine, bytecode imo would be assembly code encoded in binary, for example: 0x2234 where 0x22 is the operation (ADD e.g) and 0x34 would be the parameters But just my opinion!

jordixboy
Автор

Can we all appreciate how he actually walked through mud to give us that awesome analogy lol

tootyrnt
Автор

Looking forward to more videos about language implementation comparisons, and your new scripting language. Subbed!

WilhelmBerggren
Автор

I recommend everyone to try to design a programming language. That's the best way to understand why most of them are the way they are: Making design decisions without understanding or caring for the consequences. For example, one of the worst myths in computer science is that the execution speed is the most important feature. For a lot of code, being able to write it without mistakes or understand it when you have to change it is much more important than speed. In most applications, there is just a small part of code where execution speed really matters. But since execution speed is easy to measure unlike the pains of developers and users which suffer from countless bugs and security flaws. So speed it is, even when it's irrelevant.
Case in point: the Python devs took ONE YEAR to come up with an if-else-expression. The result can be understood even by a non-programmer:
value = a if condition else b

PhilmannDark
Автор

1:03 "öö-Entschuldigen sie, for loop ist schneller" - i was so cunfused

nathanoy_
Автор

Well done on the video and on the language, keep it up!

fxfawkes
Автор

Hello! I just came across your channel, and I think you're massively underrated. Keep the content up!

dimitar.bogdanov
Автор

Sehr interessant! Hat mir einen neuen Einblick in die Funktionsweise von Python gegeben!

ganster
Автор

Loved the succinct explanations! Thanks for sharing!

veerasivarajan
Автор

A couple of things I learned while working on my own language. It is about twice as slow as Python when calculating the Fibonacci sequence. However, when Python has to use integers it completely shits itself while my language does it in about the same amount of time. Also writing output to the console is much faster in my language. It uses both a stack and registers and supports a couple of numeric types.

I think a big factor in the speed depends on how many numeric types you support. If you only do floating point numbers you might gain a lot of speed because there is no need to do any conversions from A to B and vice versa. Also no need to even consider whatever numeric type you're processing because there is only 1, and if you want integers you just round up or down. Lua technically only has doubles so that might explain why it is so fast. Another aspect I've been thinking about is the fact that any stack/register based VM with its own bytecode essentially emulates real hardware. It can't benefit from hardware acceleration to do computation but instead it uses multiple layers of abstractions to achieve a result. Maybe that's why JIT compilers are able to extract more juice because they convert custom bytecode in actual machine instructions which could make execution a lot faster. Anyway interesting video it really gave me something to think about.

Edit: Python is sort of cheating by returning +Inf when the number overflows. Reading through the comments someone already pointed that out. It is in fact slower than my language. It would be interesting to see you do this test again with a different computational example where Python can't use trickery.

swansonair
Автор

I'm writing my own scripting language and it's also heavily inspired by Lua, so this video was really fun to find! This is really awesome. c: Your language looks amazing!!

kellybmackenzie
Автор

Oh I saw your post on discord a while back. This is looking great.

theothercreare
Автор

And that's why CPUs use registers and not stacks. (yeah not entirely, but from implementation details its a lot simpler for overhead to not rely on stacks)

Spartan
welcome to shbcf.ru