Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Node with Bun #81

Open
dev-guy opened this issue Sep 12, 2023 · 7 comments
Open

Replace Node with Bun #81

dev-guy opened this issue Sep 12, 2023 · 7 comments

Comments

@dev-guy
Copy link

dev-guy commented Sep 12, 2023

Bun 1.0 was released last week. There are many issues with SSR - it's slow and at times erratic. Perhaps Bun is the answer.

https://bun.sh/guides/ecosystem/sveltekit

@dev-guy dev-guy mentioned this issue Sep 12, 2023
@dev-guy dev-guy changed the title Replace node with bun Replace Node with Bun Sep 12, 2023
@woutdp
Copy link
Owner

woutdp commented Sep 12, 2023

This seems like the way to go, there's a couple of issues that could be possibly closed by this. Anyone feel free to pick it up or create a separate package like https://github.com/revelrylabs/elixir-nodejs

@voughtdq
Copy link
Contributor

There are a few ideas I have for fixing SSR, but all would require experimentation.

One idea is creating a general purpose cnode addon for Node.js. That way, Node.js does work and replies to the erlang messages it receives with the rendered components. This would also offload some of the cost of converting JavaScript types to erlang terms since the communication and conversion is done natively.

The other idea is to use something like zmq and create a communication protocol with Node.js.

Even going with Bun and implementing a cnode there might speed things up.

Of course doing this communication over TCP could actually end up slowing things down.

There are also other things to try with the existing Port - like avoiding converting data received from the Port to a binary and just using the charlist it passes instead and not trying to encode it using Jason.

Opinions on making an SSR behaviour and allowing configuration to define what SSR module gets used? This would make experimentation and testing with various implementations easier.

@woutdp
Copy link
Owner

woutdp commented Sep 12, 2023

Great idea to create an SSR behaviour. I can imagine some people would still want to use Node as they might already be using that dependency in their project, and are reluctant to add Bun as an extra dependency. So would be nice to be able to plug in whichever SSR backend you want to use.

As for the implementation I'm not familiar with cnode, no opinion on it.

I'm mainly looking at speed and reliability. Whichever is fastest and renders without issues would be ideal.

@voughtdq
Copy link
Contributor

Sounds good. I will try to put something together to get an SSR behaviour.

@gevera
Copy link

gevera commented Sep 22, 2023

https://github.com/crbelaus/elixir_bun

It seems there is already a Bun package for Elixir. I'll leave it here for reference

@ahacking
Copy link

ahacking commented Dec 13, 2023

Have you considered Deno and specifically deno_ex instead of Node or Bun?

Svelte seems to be available too https://deno.land/x/[email protected]

@woutdp
Copy link
Owner

woutdp commented Dec 15, 2023

Have you considered Deno and specifically deno_ex instead of Node or Bun?

Svelte seems to be available too https://deno.land/x/[email protected]

Yes although I'm not sure if deno would fix the performance issues. In any case, I want the SSR 'runtime' to be configurable, so you'd have the option to choose between Node, Bun or Deno (and maybe others later).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants