Skip to content
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

Improvement: Assignment string2: str = string1 * N takes a very long time for a large integer N #2616

Closed
kmr-srbh opened this issue Mar 19, 2024 · 0 comments · Fixed by #2634

Comments

@kmr-srbh
Copy link
Contributor

kmr-srbh commented Mar 19, 2024

N = 106

string1: str = "a"
string2: str = string1 * 10**6

CPython

(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ time python3 ./examples/example.py

real    0m0.038s
user    0m0.021s
sys     0m0.017s

LPython

(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ time ./src/bin/lpython ./examples/example.py

real    0m29.449s
user    0m29.396s
sys     0m0.049s

N = 107

string1: str = "a"
string2: str = string1 * 10**7

CPython

(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ time python3 ./examples/example.py

real    0m0.055s
user    0m0.030s
sys     0m0.025s

LPython (force break)

(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ time ./src/bin/lpython ./examples/example.py
^C
real    9m24.159s
user    9m23.510s
sys     0m0.144s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant