stefanos82
Joined 10 years ago
Joined 10 years ago
Oh my...why I don't believe this statement of his?!
I've got a nice `==31604==ERROR: AddressSanitizer: stack-use-after-scope on address`
Here's what I have replied to you:
To be honest with you, I am not sure how to answer your question.
What I can say is that when you identify bottlenecks within a project -- whether using Cython or mypyc -- the goal is to improve code performance by optimizing the specific parts that impact the project as a whole.
Naturally, the objective is not to replace the entire codebase (switching from Python to Cython), but rather to use the right tool for the job.
In this instance, that tool is mypyc; it requires no changes to your existing code -- it simply generates a Python module that you can then import into your project.
I hope my answer satisfies you, even just by a bit.
There are times that it generates faster code than Cython! Of course with Cython you can tweak it and push its limits with various optimizations and other techniques, but for using your existing code as it is and gain massive performance improvements, mypyc it's a must!
Code sample:
import time
def fib(n: int) -> int:
if n <= 1:
return n
else:
return fib(n-2) + fib(n-1)
startTime = time.time()
fib(35)
duration = time.time() - startTime
msduration = duration * 1000.0
uduration = msduration * 1000.0
print(f'{duration:.6f} seconds, {msduration:.2f} ms, {uduration:.2f} μs')
$ python3 mypyfib.py
1.452477 seconds, 1452.48 ms, 1452477.22 μs
$ # the same code compiled with `mypyc mypyfib.py` produces the following:
$ python3 -c "import mypyfib"
0.063701 seconds, 63.70 ms, 63700.91 μs
This is huge, if you think about it! 95.61% reduction in time
2180.15% increase in performance
22.80x faster
[1] https://github.com/mypyc/mypycI don't know whether I'm doing something wrong or not, but it made me appreciate the hard work you and all C3 contributors put on the entire codebase!
You mean it's pronounced "muscal", like Mezcal, but with an "ah" LOL!
But personally? I won't stop using technology and I do my best to avoid AI as much as possible.
I like exercising my mind, to develop new ways of thinking and above all, cultivate critical thinking!
If there's no critical thinking, there's no creativity, no arts, no nothing!
In conclusion, LinkedIn is dead as we once knew it and has become a massive AI slop, a dating app believe it or not(!), and full of narcissists that have supposedly succeeded in life, trying to convince themselves with their own lies. PATHETIC!
How about `cast<int*>(myage)`?
I guess I can define my own way of casting with a macro, `castAs(int *, myage);` and that should work just fine.
...for some reason, I can't stand this syntax! I find it visually intrusive lol! But if we could allow something like `int(myage)`, it makes it clearer, to me at least.