borg icon indicating copy to clipboard operation
borg copied to clipboard

Question: why not use Cython or mypyc for all the code?

Open alexconstsh opened this issue 4 years ago • 6 comments

Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

QUESTION

Describe the problem you're observing.

Hello. My assumption is that .pyx files are Cython files while .py are regular Python files. I am curious as to why you would want to compile only specific parts with Cython? Wouldn't it make sense to compile everything?

alexconstsh avatar Sep 16 '21 19:09 alexconstsh

We use Cython for:

  • interfacing to C libraries, external as well as self-made
  • some performance critical code (if not using even C for that)

I never tried using Cython for all.

Using it for the not performance-critical parts of the code might have more disadvantages (compile time, binary size, debugging) than advantages though.

What might be more interesting is to identify more parts of the code that are perf critical.

ThomasWaldmann avatar Sep 22 '21 14:09 ThomasWaldmann

What might be more interesting is to identify more parts of the code that are perf critical.

What are the tools used with Python for this? As a C/C++ developer I am mainly familiar with callgrind tool from valgrind project.

alexconstsh avatar Sep 26 '21 20:09 alexconstsh

It might be worth looking at mypyc if you are looking at something to process the rest of the code.

stuaxo avatar Apr 29 '22 10:04 stuaxo

https://mypyc.readthedocs.io/en/latest/introduction.html

Good idea. But:

  • we do not have that many type hints in the code yet
  • mypy is not integrated into our workflow yet, see my still open mypy PR. #6862
  • mypyc is alpha still, guess we want to wait a bit until it is at least beta.

ThomasWaldmann avatar Apr 29 '22 13:04 ThomasWaldmann

When I experimented with mypyc on pluggy it yielded horrible results in terms of reliability, not something I'd Want in backups

RonnyPfannschmidt avatar Apr 29 '22 17:04 RonnyPfannschmidt

Do you mean in terms of correctness or in terms of reliability for speed ups ?

I can imagine pluggy being more on the tricky end for something like mypyc so I'm sure they would welcome the bug reports.

stuaxo avatar May 02 '22 17:05 stuaxo