Replies: 4 comments 11 replies
-
Hi, CPython is the default and most widely used Python implementation. Note that just-i-time compilation for CPython is in the works. Thanks.
|
Beta Was this translation helpful? Give feedback.
-
May I ask a question: If the performance is important, why does NVDA use Python, instead of using languages such as C/C++ everywhere? Now some of the (performance-critical) modules are already written in C/C++. But also, Windows API functions might be easier to use in C++ than in Python in some cases. Python requires you to write boilerplate code in order to use those APIs, while the Windows SDK already has C/C++ header files that have all the definitions. One of the benefits of using a dynamic language like Python is that it's easier for add-on code to interact with anything inside NVDA, and even patch/modify NVDA's code. The add-on's code becomes essentially part of NVDA's code when loaded. Is this considered an advantage, or a "security loophole"? If the answer is the former, then the Python API should be kept. I'm curious about the "new sandboxed add-on API" mentioned in #18449. Would they still be in Python? Would the add-ons be run in dedicated processes? Would the process permission be locked down like Chromium renderer processes? There's actually a similar problem for 64-bit migration: 32-bit plugins cannot run in 64-bit processes, so there must be some kind of cross-process add-on API that supports this. |
Beta Was this translation helpful? Give feedback.
-
I tried PyPy. Unfortunately, comtypes cannot work with PyPy. comtypes is designed to work with CPython, and relies on some CPython APIs. So if we want to use PyPy, we would have to use another COM library, or patch comtypes in some way. COM itself does work in PyPy, if you use the functionality provided by ctypes, but libraries that rely on CPython would fail. Nuitka, on the other hand, works with comtypes, as it's fully compatible with CPython. So it might be easier to migrate to Nuitka. Exe files compiled with Nuitka can still load external Python code files (.py) with |
Beta Was this translation helpful? Give feedback.
-
I tried Nuitka, but haven't succeeded in getting it to work. I'm not that familiar with Nuitka and the NVDA's building system, after all. The current Also, compiling would take a significant amout of time. Interestingly, some .py files in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Originally raised in #18449
Has anyone investigated NVDA with pypy or nuitka?
NVDA could see real performance gains as a compiled program with Nuitka.
However, this would make functionality like python add-ons and the NVDA python console unusable.
Given this, is there any value or interest in creating an experimental version of NVDA with Nuitka?
This could provide two sorts of benefit:
On the other hand, people often suggest
pypy
as even more performant to nuitka, and this would keep the python API available.It's not 100% clear to me why we chose cpython over pypy given the performance differences.
I know in the past there's limited support for C extensions and the language lags behind a bit (still on 3.11).
I'm not sure if it's still an issue, but I'm guessing it's fairly majorly broken with NVDA given the C extension issues.
CPython is also building a JIT compiler to rival pypy, so pypy may become redundant in future version of Python
Beta Was this translation helpful? Give feedback.
All reactions