HN user

yuri91

160 karma

https://github.com/yuri91

Posts5
Comments44
View on HN

I work on a project that does exactly that (and more): https://browserpod.io/.

Currently it supports Node, but we plan to add Python, Ruby, git, and more.

You can see it in action in this demo: https://vitedemo.browserpod.io

More info here: https://labs.leaningtech.com/blog/browserpod-10

Ah and kudos to Syrus and his team for this release. Edge.js's architecture seems to have many similarities with BrowserPod. I see it as proof that we are both going in the right direction!

So using agents forces (or at least nudges) you to use go and tailwind, because they are simple enough (and abundant in the training data) for the AI to use correctly.

Does this mean that eventually in a world where we all use this stuff, no new language/framework/library will ever be able to emerge?

Competing with the existing alternatives will be too hard. You won't even be able to ask real humans for help on platforms like StackOverflow because they will be dead soon.

WASM 2.0 1 year ago

On the Web, you can do that today. This is what https://webvm.io does for example. It jit-compiles Wasm modules at runtime from the original X86.

Looking forward to progress on the memory control proposal(s). Another reason to want more than 4GB of memory is to have more address space, assuming that you have the ability to map it. With that capability Wasm64 could be useful also for apps that don't plan to use a huge amount for real.

I asked ChatGPT what it thinks about this ruling:

As an AI language model, I do not collect personal data directly as I do not have access to user information. However, I understand that OpenAI, the company that developed and manages the platform, has been ordered to temporarily limit the processing of data of Italian users and is under investigation by the Italian Data Protection Authority.

As an AI language model, my purpose is to provide conversational assistance and generate human-like text based on the input provided by the user. My training data is sourced from publicly available text on the internet and does not specifically target any individual or collect personal data.

I understand that OpenAI has been accused of not providing adequate information to users regarding the collection and storage of personal data and not having a legal basis for such collection. I cannot comment on OpenAI's specific policies and practices regarding data collection and storage, as I am not privy to such information.

However, I believe that it is important for companies to prioritize user privacy and to comply with data protection regulations. I hope that OpenAI will take the necessary measures to address the concerns raised by the Italian Data Protection Authority and implement appropriate safeguards to protect the personal data of its users.

Indeed, as I said it can be a downside.

What we usually suggest is to compile most of the application to Wasm (which is also the default), and move the parts that most interact with the outside world to JS.

This can actually result in a speedup if it avoids multiple back-and-forths between JS and Wasm, which is common if you use a Browser/JS api from Wasm.

Disclaimer: I work on Cheerp.

We do include the C (Musl) and C++ (Clang's libcxx) standard libraries.

And we do have some custom LLVM passes to improve code size and performance (See for example [1] and [2]).

But the main selling point in my opinion is the ability to target JavaScript, and (almost) freely mix data and code compiled to either JS or Wasm.

Emscripten can also target JS, but it still retains the linear memory model of Wasm (or X86, Arm, ...), which means that what you get in the end is a big TypedArray and operations on it using basic types.

With Cheerp, code compiled to JS uses an object memory model: a C++ object will become a garbage-collected JS object. While this has some limitations (you can't do unsafe casts and treat your memory like it's a big array, because it isn't), it allows seamless integration with the Browser (or any third-party) APIs:

- You can store a DOM element directly in your C++ objects (instead of doing everything through tables)

- You can directly manipulate JS Strings instead of constantly converting back and forth to C strings

- You can create nice zero-overhead interfaces to use your C++ classes from manually written JS

- Or, you can just write your whole program in C++, including callbacks for DOM events and whatnot

And you can still compile the peformance-sensitive or type-unsafe parts of your code to Wasm (losing access to some convenience in exchange for speed).

You can get an idea from the Pong tutorial [3], although it's a bit of a contrived example to showcase what can be done.

[1] https://medium.com/leaningtech/partialexecuter-reducing-weba...

[2] https://docs.leaningtech.com/cheerp/Cheerp-PreExecuter.html

[3] https://docs.leaningtech.com/cheerp/Cheerp-Tutorial-Mixed-mo...

By "Wasm JIT API in JavaScript" I mean a native way for the browser to support the JIT use-case.

Generating entire modules works, but it has a number of issues.

For example, you need to carefully decide how big your modules are going to be:

- Too small, and you end up compiling many many modules, which eventually crashes the browser if you don't dispose of the old ones

- Too big (many functions batched together), and you have too much latency before your code is available to run

Being able to compile a single function to add to an existing module (or something like that) would help a lot.

This is a nice overview on how to achieve just-in-time compilation in Wasm, and the demo is pretty cool. Good work!

We use similar techniques to power Webvm[1], an X86 Virtual Machine that runs linux programs in the browser.

A proper Wasm JIT API in JavaScript would be even better of course, but as the article says, cool things are already possible right now.

I expect to see more projects doing Wasm just-in-time compilation in the future (I believe that V86[2] also already does it)

[1] https://webvm.io/

[2] https://github.com/copy/v86

Actually even C++ can benefit from this.

In LLVM C++ coroutines compile down to functions with the "musttail" attribute, that right now is not possible to express in Wasm [1].

It is also useful to efficiently implement stuff like interpreters, where you use it as a way to jump to the code of the next instruction directly (Wasm has only structured control flow, but you can see a tail call as a sort of jump/goto instruction)

[1] https://discourse.llvm.org/t/supporting-coroutines-without-t...

I have been using lldap for a while (paired with Authelia), and it is a real godsend.

I feel like I need a PhD to configure openldap, while this was as out of the box as it gets.

Kudos to the devs!

The article mentions WebAssembly as having the same issue as spir-v with structured control flow, but actually in Wasm it is quite a bit better, because you are allowed to break/continue from an arbitrarily nested block.

This allows you to convert any reducible CFG without losing runtime performance, and only pay a price for irreducible ones (which are somewhat rare).

Shameless plug: I wrote an article about solving the structured control flow problem in WebAssembly -> https://medium.com/leaningtech/solving-the-structured-contro...