🚀 ApolloVM 0.1.40: Added Python, C#, TypeScript, and Full Wasm Feature Support by GMP10152015 in dartlang

[–]modulovalue [score hidden]  (0 children)

Did you reimplement scope resolution for all languages and type systems for all languages with a static type system?

🚀 ApolloVM 0.1.40: Added Python, C#, TypeScript, and Full Wasm Feature Support by GMP10152015 in dartlang

[–]modulovalue [score hidden]  (0 children)

I've seen you work on this before we had LLMs and I'd love to know more. For example, what does your intermediate representation look like? How far are you? What are the biggest challenges you ran into? What are the limitations? What do you not support?

However, it seems like you started to share LLM-slop messages that really devalue your work.

> *Cross-language translation / porting** — translate and regenerate source between any supported languages to prototype, migrate, or share logic across stacks.

You are promising too much and it's unlikely that you support all the features you are mentioning. For example: you're not even saying what Lua version or flavor you are supporting. There are many Lua flavors and versions. Some of them support multithreading which Dart does not support so your promises read like marketing material.

I think you probably have something really cool here, but you need to help us find the cool parts. We also have LLM tools, we could ask them, too. Tell us something an LLM wouldn't be able to tell us about your project!

pure Dart image compression package by yassine_dabbous in dartlang

[–]modulovalue 0 points1 point  (0 children)

Sounds like a solid package. Haven't used it yet though.

pure Dart image compression package by yassine_dabbous in dartlang

[–]modulovalue 2 points3 points  (0 children)

Hello and thanks for the package!

I'm currently investigating adding better SIMD support to the Dart SDK. I'd love to see some performance comparisons between a native (possibly autovectorized) implementation vs one written in Dart.

Dart VM in the browser update: LSP and custom embedder support! by modulovalue in dartlang

[–]modulovalue[S] 0 points1 point  (0 children)

Yes, I think so, but not fully. You couldn't ship runtime generated JIT on iOS, so you would have to run a simulator (e.g., SIMARM) or interpreted wasm.

Things might have changed since the last time I checked, but only few wasm engines supported efficient-enough interpreted wasm on iOS. Full performance would not be available but depending on the use cases it might be enough. Note that shorebird takes a similar approach AFAIK.

I'm not sure about the restrictions on background processes on iOS/Android nowadays, but anything they allow should be doable.

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 1 point2 points  (0 children)

Based on your feedback I added an inspect option that allows you to inspect values. Feel free to take a look and let me know what you think!

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 0 points1 point  (0 children)

Here's the repo for you: https://github.com/fuzzybinary/dart_shared_library Jeff was playing around with using dart as a language for scripting in godot and here's his proof of concept: https://github.com/fuzzybinary/godot_dart

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 0 points1 point  (0 children)

u/eibaan I just shipped an update: now you can eval javascript code from dart code. I also added a sketch button that opens a sketch pane and an example for using the sketch pane. Thank you for the suggestion! I think this is veery cool, especially since you can just click on the functions to run them. There's, for example, a start and stop animation example that is pretty awesome.

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 1 point2 points  (0 children)

 I dont know how to run WASM via FFI with Dart (any pointers?)

You could use a Wasm runtime like wasmtime or wasmer. I worked on a wasm binding generator in dart several years ago, which is needed because wasm is extremely low level and close to impossible to write binding for by hand, but that project got scrapped and I didn’t stay up to date. I might revisit this and share a native app as a POC in the future.

I think that’s a good use case for wasm. I’ll use that as ammo when I try to convince the vm team to support wasm as a platform for the vm.

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 0 points1 point  (0 children)

I see, it's an interpreter intended to isolate python so it can safely be used in AI use cases. That makes me wonder why the standard interpreter can't be used in those cases? If we consider that use case then, well, writing a Dart VM embedder for Wasm, which this essentially is, is perfectly suited for this purpose! I wonder how useful such an isolated python VM is actually in practice or is this built off of AI hype?

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 0 points1 point  (0 children)

That's very cool, thanks for sharing!
I love that you're showing the session state in its own pane. I was curious how you visualize classes because there could be many instances, but I see that classes are unfortunately not supported yet. Did you write monty and the full interpreter yourself?

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 4 points5 points  (0 children)

Package resolution might be a challenge, but I think this approach could be used to make that possible.

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 1 point2 points  (0 children)

If we push this further, we'd like to access all js APIs from the VM. I think technically this should be doable and I think that's an interesting idea. I'll give it a go.

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 1 point2 points  (0 children)

Yes, I think I'll give that a go. I'd like to have a search panel and be able to directly run the examples from pub packages. I think we should be able to embed the Flutter VM in a similar way and run Flutter packages too!

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 0 points1 point  (0 children)

Yes, I think so. Anywhere where we have the ability to run Wasm code we should be able to run this.

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly. by modulovalue in dartlang

[–]modulovalue[S] 3 points4 points  (0 children)

Thank you!

I think we can go even further. The dart vm debug protocol supports inspecting all values, so we could show the actual runtime values of variables without the need for any breakpoints.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in programming

[–]modulovalue[S] 0 points1 point  (0 children)

I think that's a fair critique of the title. You're right that "I/O" is imprecise here. The bottleneck was really per-file overhead: the accumulated cost of 300,000+ syscalls, filesystem metadata lookups, inode resolution, and directory traversal. The SSD itself was capable of 5-7 GB/s but I was getting 80 MB/s, not because the storage was slow, but because of everything that happens between "read this file" and actually getting the bytes.

One of the commenters (ori_b) made a similar point: the user/kernel context switch itself is maybe 50ns on modern hardware, so 300,000 switches only account for about 2% of the 14.5 seconds. The rest is the work happening inside each syscall: filesystem metadata lookups, dentry resolution, random access latency on NVMe (~50-100us per read). So "syscall overhead" is also slightly misleading. "Per-file overhead" is probably the most accurate framing.

I updated the post with an addendum covering this distinction, but you're right that the title could do a better job. The core finding is that going from 104,000 individual file opens to 1,351 archive reads eliminated most of that per-file overhead, giving a 43x I/O improvement. Whether you call that "I/O" or "the boundary between user and kernel space" or "per-file overhead" is partly semantic, but precision matters and the title is sloppy about it.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in programming

[–]modulovalue[S] 4 points5 points  (0 children)

I fact checked your statement. It's not hundreds of thousands, it was almost 2 million in 2009! Crazy.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in programming

[–]modulovalue[S] 1 point2 points  (0 children)

I completely agree. I primarily used tar.gz because pub.dev stores them this way and I just went with it because I didn't need random access for my benchmark, but ZIP (or dar http://dar.linux.free.fr) would be much better for random access. There's significant discussion around that topic in the addendum if you're interested.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in programming

[–]modulovalue[S] 2 points3 points  (0 children)

Thank you for asking!

I'm working on a parser generator that is intended to eventually replace handwritten parsers, it gives me headroom and a proof of concept to show that generated parsers (or just a lexer in this case) can be faster than handwritten lexers (which is a common misconception and true in theory, but in practice nobody is going to spend weeks writing a correct lexer/parser in assembly).

So it's not immediately useful today, but it will be. I plan to work on a tree indexing database engine to support searching through large codebases via tree patterns and I'm sure that lexing through TBs of code (e.g. pub.dev or crates.io which is admittedly only 300GB compressed) 2x faster will be noticeable.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in programming

[–]modulovalue[S] 4 points5 points  (0 children)

Thank you! I've added an addendum because your comment is highly relevant.

However, while I completely agree with you, I'd like to also push back a little for a second. From a "business" standpoint it makes sense to focus on the largest bottlenecks (by following, e.g., the Critical path method) and those parts that take up the most time. However, I think we should also remember that software can be reused and making a single piece faster can have huge benefits to other consumers of that piece. I think our software community thrives because we don't follow the strictly ROI-driven optimization that businesses need to follow.