Hello everyone! Welcome to my 3rd blog post.
So, I am very happy to inform that I have passed my first evaluations with flying colors and now working on phase 2.
I learned a new way of optimization for Nuitka that doesn't need any CPython code replication. The idea is very simple i.e to build on top of existing nodes on Nuitka. Consider the following example, below is the optimization for
The above is equivalent to (in Python):
min_result_variable if min_result_variable > min_arg_variable else None
In this way we can optimize reusing existing nodes. Now the only difficulty is in the case when there is more than one argument. Such type of problems are handled in Nuitka using something called reformulation. So, by using reformulation our problem will decomposed in to a simpler problem. For example:
min(1, 2, 3) ---(reformulation)---> min(min(1, 2), 3)
Hence, in this way we can optimize in an efficient way.
Thank you for stopping by!