Debian Codegraph @

docs/community/speedup.rst

raw
1 Optional speedup extension
2 ==========================
3
4 Why?
5 ----
6
7 charset-normalizer will always remain pure Python, meaning that a environment without any build capabilities will
8 run this program without any additional requirements.
9
10 Nonetheless, starting from the version 3.0 we introduce and publish some platform specific wheels including a
11 pre-built extension.
12
13 Most of the time is spent in the module `md.py` so we decided to "compile it" using Mypyc.
14
15 (1) It does not require to have a separate code base
16 (2) Our project code base is rather simple and lightweight
17 (3) Mypyc is robust enough today
18 (4) Four times faster!
19
20 How?
21 ----
22
23 If your platform and/or architecture is not served by this swift optimization you may compile it easily yourself.
24 Following those instructions (provided you have the necessary toolchain installed):
25
26 ::
27
28 export CHARSET_NORMALIZER_USE_MYPYC=1
29 pip install mypy build wheel
30 pip install charset-normalizer --no-binary :all:
31
32
33 How not to?
34 -----------
35
36 You may install charset-normalizer without the speedups by directly using the universal wheel
37 (most likely hosted on PyPI or any valid mirror you use) with ``--no-binary``.
38
39 E.g. when installing ``requests`` and you don't want to use the ``charset-normalizer`` speedups, you can do:
40
41 ::
42
43 pip install requests --no-binary charset-normalizer
44
45
46 When installing `charset-normalizer` by itself, you can also pass ``:all:`` as the specifier to ``--no-binary``.
47
48 ::
49
50 pip install charset-normalizer --no-binary :all: