--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/c7a69547-13e2-4eb9-aab8-1cbf47862e84n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/dbfb389b-5b54-43ef-9031-62627a6c0a76n%40googlegroups.com.
Brython can conceivably do this, but so far it hasn't been implemented for understandable reasons (Pierre has to prioritize and it's not a common need).Use this: https://github.com/denis-migdal/Brython-AOT
- re-implementing the py2js process into a langage able to manage allocations (e.g. C++) then converting it into WASM ?
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/9f9de7d2-8e2d-4da9-b735-e3fad427b2b8n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAF1%3DpDmORtciEQ%3DQTMe7sv%2BU2dXv115Gt6nea7wv3%3DCcvenmSw%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAHyr3Yg8srQsMBirSx0zgdfPoOb7aq3ZRnacsFaEUzgJm172Yg%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAF1%3DpDmN1vmB34GC9__86E2p%3DXGdhKyrzvP6wcSb47kWsSorBw%40mail.gmail.com.
For that, I'd need a collection of real life code I could test. I think I'll be able to get some student code for that.But could be great if somebody had some code (or part of code) we could test.
To view this discussion visit https://groups.google.com/d/msgid/brython/bb0a2f69-a4bb-491a-aa01-b7d5e6cacff2n%40googlegroups.com.
- py2js is responsible for 97% of the startup time (99% in SBrython). So if you use AoT in Brython, you should have a 33x faster startup time.
-> also if you use AoT, you could also use a smaller brython.js (2-4x smaller ?), so also a reduction on Brython startup time
Since the beginning there have been countless suggestions to use AoT in Brython, and my position has not changed: by design, I want the development cycle to be as simple for Brython as for Javascript : edit the source code / reload the page. If you have an intermediate step (a program that translates Python to Javascript before running code in the browser), you have to run it every time you change the source code, and you also have to translate the whole code base (including the standard library) every time you change the translation engine
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAF1%3DpDnEfHmE_49LdrmwFEVpVTM%3DS4uQQjn2DwO61tbkhaqzVg%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAFr00W4z5ZEz1ja-gkPM_Eww8uG_YJkXaVWKmGo25aV%2BnTEE-Q%40mail.gmail.com.
Thanks for sharing, Pierre. Design decisions are very interesting. It's good to understand your rationale.In that light, I have a few questions:Since the beginning there have been countless suggestions to use AoT in Brython, and my position has not changed: by design, I want the development cycle to be as simple for Brython as for Javascript : edit the source code / reload the page. If you have an intermediate step (a program that translates Python to Javascript before running code in the browser), you have to run it every time you change the source code, and you also have to translate the whole code base (including the standard library) every time you change the translation engine1) What's the reason for wanting to make development cycle as simple as possible? Is it because your primary audience is students / academic environment?
2) Is pre-compiled (transpiled / translated) code incompatible with simple development, ie no extra steps? Isn't it possible to have both? In fact I think brython does have both to some degree: brython runs straight python code, but caches translation in browser as a speed optimization.3) If speed optimizations are acceptable when they don't compromise developer simplicity, why only optimize the single user case? Brython's browser caching optimization only speeds up loading (parsing / translation) for one user in one browser accessing the same page repeatedly. Why not consider optimizations across the entire system, as long as developer simplicity remains unchanged?4) What about optimizing speed for many users across many browsers? Typical websites / web apps serve thousands or millions of users a day. That duplicates a tremendous amount of work: every user's browser has to parse and translate the same static brython code on loading the page. Why not have the server translate brython to js once per script, and serve the resulting js code to thousands or millions of users? That saves time & energy across the system as a whole. If you run an internet site maybe you don't care much about duplicating end users' cpu time. But if your brython app serves a large internal network then duplication matters. It also speeds up first load for everyone if brython script is already parsed & compiled to js.5) Isn't it possible to achieve precompilation as an optional step? For instance: brython.js runs and finds scripts on page. If it finds type "text/python" then it parses and compiles as currently happens. If it finds a pre-compiled type, like say <script type="brython/javascript"/>, then brython knows to proceed without parsing / translating the code, just like if it found the code in indexedDB cache. This gives developers the option to add better first-load performance and reduce resource duplication if needed. While preserving the current simplicity for those who want it.
6) Couldn't precompilation be implemented invisibly, without even needing to explicitly run a compile cycle? The web server can compile and cache brython scripts when it detects changes to the source, then serve the compiled result. Any significant brython app needs to be served from more than just "python -m http.server". In which case the server can be configured to handle precompilation transparently. Developers and end users won't see any difference at all from how things work currently. For cases where configuring a web server to do precompiles is too much effort, brython can continue to work exactly as it does now, parsing and translating python code on the fly in each browser.Would you be willing to support more system-level optimizations as an optional step, as long as current development simplicity is maintained?
@Pierre: it doesn't seem that Brython is using If-Modified-Since when fetching scripts.
It might be interesting to use it in order to not download scripts if they weren't modified since their last download.
This is a good illustration of why I try to avoid adding execution options : even one of the persons who know Brython best has not noticed the option "cache" which enables the use of browser cache if the server supports it.
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CA%2BgUBLT5yc8J7WH1xWKTmHp_R1Kkiu65L99S32qQR1CZG443bQ%40mail.gmail.com.
I use something different in Brython-AOT, but else, you only need to do:
jscode = doc.querySelector ('script.myjscode').innerTextnew Function (jscode) ();
This is a good illustration of why I try to avoid adding execution options : even one of the persons who know Brython best has not noticed the option "cache" which enables the use of browser cache if the server supports it.My car has an option for emergency blinker lights. I've never used them. But if I crash on the side of the highway then they become priceless.
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAF1%3DpDkbAuLkZ-AjY5y%3DvE%3DvJsqOJphFfzr5k0zr6i6p3w-cUQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/79be0f69-cedb-4b64-81ff-b71844d03fa6n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAF1%3DpDnc1-e1g6ZiGnUgJvxj3C-mLmZqo7Q7c87Nosyo0%2Br%3D3Q%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAFr00W4ZEOx4h2ysDwzpA8MkPRyQOmbNdxYS7e49eStBUQfq-A%40mail.gmail.com.
Uncaught TypeError: Cannot set properties of undefined (setting '__name__')
at pie_chart.py.js:7:17
var $B = __BRYTHON__,
_b_ = $B.builtins,
locals_exec = $B.imported["exec"],
locals = locals_exec,
frame = ["exec", locals, "exec", locals]
var __file__ = '<string>'
locals.__name__ = 'exec' // <--- LINE 7
locals.__doc__ = _b_.None
To view this discussion visit https://groups.google.com/d/msgid/brython/CAFr00W4ZEOx4h2ysDwzpA8MkPRyQOmbNdxYS7e49eStBUQfq-A%40mail.gmail.com.
locals_exec.panel = $B.$getitem(locals_exec.document, 'panel',[8,17,24])
To view this discussion visit https://groups.google.com/d/msgid/brython/820bc463-456e-4417-8cf6-aade3a170d51n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAF1%3DpDk-siH_DOkeT%3DPgcJXGCQJWmCOXOrLEEUXWu8P9fc7SjQ%40mail.gmail.com.
Uncaught ReferenceError: $varB is not definedat pie_chart.py.js:41:3
$varB.set_lineno(frame, 21)
To view this discussion visit https://groups.google.com/d/msgid/brython/CAFr00W4CRpDj54uo9bueh10QJxutiuWBX8i%3DgRVZG9xPpUvZ1Q%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAF1%3DpDmpOKDZDALBVTGdAXRGypHvTO-qpX8Wen6KwqDufpJGqA%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/CAFr00W4c%3Dj5Fqd0c20jg3XKqLwbDgbFPUFyYzxv%2B2yXCHfsu-g%40mail.gmail.com.