Hello everyone! Welcome to my first blog post.
There are a total of 69 built-ins in Python 3 and 76 built-in in Python 2 out of which 27 built-ins are yet to be optimized in Nuitka. My aim is to optimize those missing built-ins in Nuitka. This will make Nuitka a lot faster while working with CPython built-ins.
The first built-in that I'm going to start with is "any" built-in. I have already implemented a generic algorithm for the optimization for cases like any( * 10000). But there is problem with this algorithm i.e it doesn't have support for Dict and Sets datatypes because they are non-indexable. A solution to problem is embracing the fact that python internally uses iter() and next() while working with loops. Using these we can easily iterate over the elements in the dictionary and set datatypes. The idea is to have a limit for the number of elements we will iterate through and try to predict the True value, for example any() or any(*100) is always going to be False. In the same way any(*1000000) is also False but it's too expensive to iterate of all the million elements and find their truth value that's why we need to a limit. This solutions will also be helpful with future optimization that need to iterate through every element.
Thank you for reading :)