~gbaptista

Brazil

Recent activity

[PATCH] migrating repl to a web worker with fallback 3 months ago

From gbaptista to ~technomancy/fennel

Hello,

This patch suggests using a Web Worker for the web REPL. We had an issue
with the last one (https://lists.sr.ht/~technomancy/fennel/patches/12080).

The problem was that we had missing files in the upload process inside
the makefile. This patch solves these problems, and I improved it to
ensure a compatible fallback for browsers that do not support Web
Workers. Also, the shim.lua test still works.

I uploaded a version to make testing easier:
https://gbaptista.com/fennel/ (fennel / 123)

Tested on: Luakit, Nyxt, Chromium, Firefox, Brave, and Opera.
[message trimmed]

Re: Fwd: [PATCH] migrating repl to a web worker 3 months ago

From Guilherme Baptista to ~technomancy/fennel

Phil Hagelberg <phil@hagelb.org> writes:

 > Shoot; actually I spoke too soon--this causes the repl to break in
 > Luakit, so I had to revert it. I don't see any errors or anything; it
 > just shows "Loading..." and climbs up to 99% but never gets beyond that.

Oh, sad to hear that. Thank you for trying to apply the patch and report
the problem.

I realized that I hadn't done any tests on luakit, so, my bad! Sorry
about that. I will check what is going on and try to fix it.

I will also test it on the nyxt browser besides luakit. Suggestions
about other browsers that we should use in the tests?

Re: [PATCH] Improving the REPL loading feedback 3 months ago

From Guilherme Baptista to ~technomancy/fennel

On 8/22/20 1:10 PM, Phil Hagelberg wrote:

> Seems like this would be easier if the Fengari compiler could be made to
> yield every so often, but sadly since it's JS, it doesn't have 
> coroutines.
> But maybe we could at least split up the parsing and the compiling and
> the loading of fennel.lua?

I did an experiment, and 90% of the time is spent on loading the
complete Fennel source; the other 10% is for the REPL. I'm not sure how
much this part would be splittable.

I believe that we can use a Web Worker without changing too much code.

[PATCH] migrating repl to a web worker 3 months ago

From gbaptista to ~technomancy/fennel

Hi!

This patch suggests using a Web Worker for the web REPL. I tried to
modify as little code as possible.

Tested on: Chromium, Firefox, Brave, and Opera.

Included in this patch:

repl-worker.js:

Fengari does not have a straightforward way to deal with Web Workers;
This file evaluates the Worker written in Lua and makes it accessible
in pure js for the Web Worker.
[message trimmed]

[PATCH] Improving the REPL loading feedback 3 months ago

From gbaptista to ~technomancy/fennel

Hi!

This patch improves user feedback when loading the repl.

I found that the problem is related to how the Javascript Event Loop works. The talk "What the heck is the event loop anyway?" by Philip Roberts was a joy of knowledge!

This patch does not solve the entire problem: The fact that the browser still freezes during the loading and the page does not respond until the repl is loaded makes me crazy.

I will try to do some experiments, and if it works, I send a second patch. Probably some solution using js async feature or Web Workers will do the trick.

---
 init.lua | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
[message trimmed]