-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RustPython Slow to Normal Python #5178
Comments
Currently RustPython is a lot more slower than CPython. Implementing more optimization will improve it. |
import time
def test_list_operations():
lst = [i for i in range(100000)]
start_time = time.time()
for _ in range(1000):
lst.append(len(lst))
lst.remove(lst[0])
end_time = time.time()
print("List operations took", end_time - start_time, "seconds")
def test_dict_operations():
dct = {i: i**2 for i in range(10000)}
# 添加键0到字典中
dct[0] = 0**2
start_time = time.time()
for _ in range(1000):
dct[len(dct)] = len(dct)**2
# 检查键是否存在,然后删除
if 0 in dct:
del dct[0]
end_time = time.time()
print("Dictionary operations took", end_time - start_time, "seconds")
def test_loop():
start_time = time.time()
for _ in range(1000000):
pass
end_time = time.time()
print("Loop took", end_time - start_time, "seconds")
def test_function_call():
def dummy_function():
pass
start_time = time.time()
for _ in range(1000000):
dummy_function()
end_time = time.time()
print("Function call took", end_time - start_time, "seconds")
test_list_operations()
test_dict_operations()
test_loop()
test_function_call() Comparing the running of cpython and rustpython, only function calls are very slow, which may not be tolerable.
But I really like this project because it no longer requires a runtime with cpython, which is great! |
Thank you for sharing the insight. One of the missing optimization in RustPython is vector call. It maybe related. |
Summary
i can check the speed test rustpython and python
but result is not good i think so rustpython create to increase python code execution speed
please can you explain
The text was updated successfully, but these errors were encountered: