7 ms·
The reality is that the "dark" majority of preexisting code has essentially no performance requirements/concerns; they're business scripts that could literally
by esrauch 3y ago
The reality is that the "dark" majority of preexisting code has essentially no performance requirements/concerns; they're business scripts that could literally run on a toaster with no problem if you could get the code onto it.
So really most business logic can easily be satisfied by "compile the interpreter to wasm and then run the dynamic language on that", and doing it this way can move existing "learned the hard way special cases" byzantine business code to something that can run on a web server and be accessed by the companies employees rather than passing around scripts for them to run, with a lot of benefits including instant upgrades for everyone for bug fixes.
That said, this specific impl claims to only support half of the standard library so I kinda doubt its ready for any 'serious' business usecases yet anyway.
- DanielHB 3y agoI don't think you grasp quite the implications of what I was saying, this kind of approach could take _seconds_ to even start running your python application. Large python codebases could take like a minute to start if loaded that way. Once it does start then your arguments can make sense, but even so it would still make it impractical for most things. Trust me, when the Javascript dev tells you something will be slow, it WILL be very slow
- jsheard 3y ago> I don't think you grasp quite the implications of what I was saying, this kind of approach could take _seconds_ to even start running your python application. Indeed, the web demo takes about 5 seconds to cold-start on my beefy PC, between downloading the 22MB WASM blob and compiling it. It also grows the WASM heap to 160MB after running the simple Fibonacci example, and WASM heaps can't (yet) be shrunk, so the only way to reclaim any of that memory is to discard the whole instance and start over. It's cool that it works, but not very practical.
- antonjs 3y agoDepends a little on if you're going to a website to use an app, or running something on a always on PC on say a production floor where the app never gets exited, I'd think.
- jsheard 3y agoIf you're not targeting the web, what would be the point of running a Python runtime on top of a WASM runtime? You could just run RustPython as a native binary, or use ol' reliable CPython.
- amelius 3y agoI guess parts of this can be cached, so if you use the app more than once it will be faster (or at least it has the potential for it).
- hoodchatham 3y agoAs far as I'm aware, even discarding the instance isn't good enough, since v8 doesn't seem to reclaim the Wasm Linear Memory ever. I think the only thing you can do is start it in a worker and then terminate the entire worker.
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- simonw 3y agoPyodide (standard cPython in WebAssembly) loads surprisingly quickly. My https://lite.datasette.io https://lite.datasette.io application usually starts up in less than 10s - most of that is downloading about 10MB of WASM blobs, and 10MB isn't actually that big these days (many sites serve more than that in image headers). When I built Datasette Lite I did it as a research project, assuming it would be far too slow loading to be useful. I've since changed my mind on that.
- jjtheblunt 3y agoYour project seems very cool, and good on you for it. 10 seconds is absurdly slow, though. That's like time to install Mathematica from a disk image level slow.
- simonw 3y agoI thought it was too slow as well, but apparently it's not - plenty of people are using it now, and I myself use it way more than I thought I would.
- polygamous_bat 3y ago> 10 seconds is absurdly slow, though. I hate to say this, but have you used any $ModenWebApp with $HotJSFramework recently? I thank the gods when those pages load without a 5-10 second of fancy spinning animation. Really thought we would be in a better place by 2024 but nope.
- jjtheblunt 3y agoI haven't used any such slow thing yet (am mostly a commandline world person).
- nick238 3y agoDon't work for a company where you need to turn in receipts or fill out info in crappy HR software? I mean, good for you and knowing the command line, but doing the less-fun, less-specialized parts of jobs usually involves regressing to the mean of what interfaces people know how to use.
- randomdata 3y agoWhat do you envision these scripts to be doing that it would matter if it takes minutes, hours even, to start? Fire and forget. Granted, the environmental cost to all that extra energy consumption may not be palpable. Then again, you're exactly choosing Python in the first place if you care about the environment.
- mcherm 3y ago> this kind of approach could take _seconds_ to even start running Only seconds? Today it takes 45 minutes to do the update by hand, but there's this handy 20-line Python script that does it instantly. (Hypothetical example only, but it's not uncommon.)
- esrauch 3y agoI just opened Facebook.com and it took more then 10 seconds time to first content paint, and it isn't because of slow internet. I've worked on more than one FAANG external user facing site fixing stuff to get median initial page latency to be below 5 seconds, so I think your "this will take _seconds_" emphasis is kind of funny. Internal business crud apps often take multiple seconds on every click. Even a minute for an employee to start an app that is then snappy would be acceptable for practically any internal business usecase if they can just leave the tab open, and there's no technology reason why python wasm interpreters would need to be that slow.
- phkahler 3y ago>> The reality is that the "dark" majority of preexisting code has essentially no performance requirements/concerns; they're business scripts that could literally run on a toaster with no problem if you could get the code onto it. Which means this whole thing is pointless from an end user point of view. The technology stack is getting very deep - Python, Rust interpreter, WASM, in a browser. I'd love to get back to running things on a toaster with no dependencies.
- jug 3y agoSounds like a use case for simple Python rather than RustPython? If you go full RustPython, surely looking to eek out performance must be a major reason to even go there rather than just script with CPython like it was 1999?
- _gabe_ 3y ago> can move existing "learned the hard way special cases" byzantine business code to something that can run on a web server and be accessed by the companies employees rather than passing around scripts for them to run Or… you could just use Django. The framework built for running python on a web server.
- Spivak 3y agoThat's totally different, at least out of the box. The use-case seems to be running user-generated scripts that aren't known in advance and can be added/edited/ran in a self-service manner. The usual way to do this is get a Python interpreter, sandbox the hell out of it on your server, and then run the untrusted code but this obviates the need for security paranoia quite a bit since it's running in the user's environment.
- IshKebab 3y ago> essentially no performance requirements In my experience this is very rarely actually true, even though people think it is.