On Mon, Nov 7, 2016 at 3:24 AM, Jonathan Verner <
jona...@temno.eu> wrote:
> I don't think a serverside application is a good idea for several reasons:
>
> -- it would need node.js to compile the modules (the compiler is written
> in javascript)
currently, py_VFS.js looks like it is stripped python stuffed into a
javascript dictionary where each key is the module name. It would be
nice if we could precompile into JavaScript but it wouldn't have to be
done with node.js. it's possible we could do it in the browser itself
as the compile environment and pushing the transpiled JS to
server-side.
> -- it would add unneeded complexity to production (running a server for
> brython caching in addition to the application server)
I agree it would add complexity but if I can eliminate tens of seconds
of wait time on start, I would argue for it as needed complexity.
> -- it would be quite complicated to write
The simple minimum viable version would take a couple of days to
write. A truly optimized version that adapts to different workloads
would be quite complicated but it isn't needed until you can actually
measure usage profiles.
For minimum viable, I would have one server-side program. To the
outside world, it would look like a URL request for an import file.
But instead of a simple file fetch and return, it would be a
relatively small bit of code that would return the import request and
add it to the "local" VFS.js if it doesn't exist. To maintain
invisible behavior, it would return the import requested file. The
next time the application runs, it would get that module from the
VFS.js bulk load.
Eventually, there will be no explicit module requests as all of them
will have been cached.
>
> A better approach, IMHO, is to precompile stuff needed by the application
> into a single file which would be deployed to production and could be cached by the browser.
Something like, VFS.js, yes?