The reason I want to use a JIT compiler for running embedded Django
applications is this:
"More recently, developers began pioneering a new field in dynamic
compilation called trace compiling, or tracing. During compilation into
the intermediate language, the compiler can mark the branches within the
code, for example, a label in front of a return statement, a jmp
operation at a break statement, or call or return. The reasoning is
simple, if you strip away all of the jumps and function calls, no matter
how long the program is, as long as its written by a human, then from an
engineer's perspective, the program will always run in negligible time.
Where programs begins to eat up memory however, are the various loops,
recursive calls, and whatnot. Essentially, the introduction of branches
makes the complexity of the program unpredictable, hence by optimizing
the frequently used loops and function calls, we can effectively balance
the efficiency of the program with the resources required to compile the
code (which is still not trivial by any means). It also solves another
major problem. Whenever the program counter (or instruction pointer)
hits one of the branch markers, its entire execution flow is traced and
stored (and will eventually be compiled if that route is taken
frequently enough). Because the program flow of a string concatenation
differs from those of an integer addition or even an overloaded
function, each of these flow generates unique traces with their unique
signatures (the input). For this very reason, if we encounter a string
concatenation before an integer addition, the program will not only be
able to identify the integer case as a completely different route, but
will also be able to break down the complexity of the environment so
that further optimizations during the compilation of the integer route
can safely assume that its inputs are strictly integers. Neat huh?" [1]
https://gist.github.com/leegao/1073233
Le 2018-01-28 à 05:00, Jani Tiainen a écrit :
Hi,
So what is your motivation to even try to make Python(and thus Django
to convert it to C code (or run it on top of something like LLVM)?
Is there some part which is too slow in your application? Are you even
sure that doing things that Django does would even be faster when
compiling it to something like C-code?
In my projects I have few really complex calculation systems and I
have resolved them by writing the slow part in C(++) and using C-types
to bind C code to my Python (Django) app.
If you're just seeking generic speedup, there exists PyPy project [1]
which can run Django and relevant database backends at least
successfully. PyPy is JIT for python, works quite well without any
modifications to Python code.
PyPy can run Django library just fine, I have seen reports about 15
times faster execution in most operations. Never used it myself though
since I haven't really found out Python be too slow in my apps.
[1] http://pypy.org/
On Sun, Jan 28, 2018 at 10:53 AM, Etienne Robillard
<tkad...@yandex.com <mailto:tkad...@yandex.com>> wrote:
Hi Jani,
I don't want to optimize my code manually except with
machine-compiled instructions.
Cheers,
Etienne
Le 2018-01-28 à 03:12, Jani Tiainen a écrit :
Hi
Why you even want to add such a complexity?
Have you measured what part in your apps are really slow?
Have you tried to optimize your python code before trying such an
extreme actions?
27.1.2018 9.04 ip. "Etienne Robillard" <tkad...@yandex.com
<mailto:tkad...@yandex.com>> kirjoitti:
Hi,
I would like to know if it's possible to compile Django code
with a JIT compiler to a C file using LLVM?
What do you think?
Etienne
Etienne Robillard
tkad...@yandex.com <mailto:tkad...@yandex.com>
https://www.isotopesoftware.ca/ <https://www.isotopesoftware.ca/>
--
You received this message because you are subscribed to the
Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to
django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/ec8bf736-c316-8e9a-01ec-16383c78e746%40yandex.com
<https://groups.google.com/d/msgid/django-users/ec8bf736-c316-8e9a-01ec-16383c78e746%40yandex.com>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the
Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAHn91ofbbm2uNyWmJ%3DH9H8eWMmFEpOPNnN3JkJy1UWmcw6kACQ%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAHn91ofbbm2uNyWmJ%3DH9H8eWMmFEpOPNnN3JkJy1UWmcw6kACQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
Etienne Robillard
tkad...@yandex.com <mailto:tkad...@yandex.com>
https://www.isotopesoftware.ca/ <https://www.isotopesoftware.ca/>
--
Jani Tiainen
- Well planned is half done, and a half done has been sufficient before...
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAHn91odnLhi9JQFzGD%2BJqLP26s0Eh1J4iJAh3mJYtiCvSDgQoQ%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAHn91odnLhi9JQFzGD%2BJqLP26s0Eh1J4iJAh3mJYtiCvSDgQoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/e5e4990d-0290-1bf4-c61c-e23ff979c5b6%40yandex.com.
For more options, visit https://groups.google.com/d/optout.