167 karma · joined Sep 25, 2019 (7y ago) · 33 submissions
comment 2w ago · link · parent
Or more concretely, if we had a parser generator + json parser specification that can generate efficient simdjson style parsers, then we should be able to parse json restricted to a subset of json based on a schema at least as efficiently as simdjson can parse general purpose json.
That way we could have the best of both worlds, a (potentially lazy) statically type-safe model and simdjson performance!
I still think that this is definitely doable, it's just that a lot of infrastructure needs to be built for it.
I remember reading that Meta is doing something similar with binary formats. I find it weird that there's nothing like that for json yet.
comment 3w ago · link · parent
Something that's not mentioned in that article is that you can maintain any monoid efficiently over balanced trees, not just the subtree size (aka you need an identity element and an associative operation). Most widely known monoids are boring, but there are more interesting monoids. Interval trees can be implemented as an augmentation using a monoid (this concept is more widely known as augmenting a tree). Range min max augmentations can be used to implement succinct trees (this comes from Sadakane's work on succinct trees, he didn't describe it as a monoid IIRC, but it turns out it is one).
By looking at it from a monoid angle, the specific balanced tree can be abstracted away. Treaps are VERY easy to implement, but the monoids apply to any n-ary balanced trees. There was an article a few days ago about very efficient B-Trees, but from what I've seen they did not support general purpose augmentations, probably because the implementation would have to be partially evaluated to be optimal while being general.
In any case, cool stuff and totally under-explored in my opinion. I hope LLMs will help us become optimal in this area one day and help us automatically select an optimal augmentation and balanced tree. There are so many problems that can be sped up by balanced trees and augmentations.
comment 2mo ago · link · parent
I guess what I would like to see is SIMD libraries being able to confidently say nobody needs to use intrinsics (or differentiate between relaxed/normal SIMD on the user API level) because the language + high level SIMD APIs are smart enough to choose the right implementation.
IIRC IEEE min/max with proper NaN handling needs 8 instructions on x86 vs 1 on arm64 I find it very sad that we apparently haven’t really solved that yet without forcing the user to use different APIs.
comment 2mo ago · link · parent
Does Rust or any other language support customizing the compiler so that interprocedural analyses can track custom subsets of, for example, doubles so that the compiler can choose the most efficient instruction sequence for example for min/max? If we know a double is never NaN then we can emit only one instruction on x86, but have to emit one more on arm64. If we know a double is never zero and never NaN, we can emit a single instruction on both.
This whole conversation between relaxed SIMD and deterministic SIMD seems to only exist because our compilers are not smart enough and/or their whole program analyses don’t support any plugin-like capabilities.
There are other examples where if we know a SIMD bitmask is canonical (all 1s per lane) then we can implement horizontal reductions more efficiently. This is very niche and I doubt that any language supports interprocedural analyses with such a rich domain, so it feels like a hole in the programming language space.
comment 4mo ago · link · parent
- repo: https://github.com/modulovalue/dart-live
- demo: https://modulovalue.com/dart-live/
It's on my todo list to support compiling dart code through the wasm bundle to wasm directly. Right now it's running the dart arm simulator on the web because it supports hot reload.
I'm wondering if there are any cool use-cases that motivate having the compiler itself run in wasm. I did it mostly for fun and besides building tooling for compiler developers themselves or IDEs, I can't come up with much.
There was one guy that wanted a sandboxed environment for agents as he couldn't find anything else. A few other people used the dart live project to build playgrounds for their own packages.
Who's the target audience for minikotlin? I'm just curious.
In any case, cool project, thanks for sharing!
comment 4mo ago · link · parent
This is mostly because their approach to SIMD is so different, but also because I can't test it at all. Are there any RISC-V "machines"? that one can use to do something useful or fun with that someone here could recommend?
I guess it would be fun seeing all my SIMD-fiable use-cases become orders of magnitude faster on RISC-V, too, but I sadly never hear anything about machines that use RISC-V.
comment 5mo ago · link · parent
Many things are possible that weren't possible before. For example, I was able to compile the Dart VM (the compiler + analyzer + VM) to wasm and run it on the web: https://github.com/modulovalue/dart-live it supports hot reload and many other cool features. It runs essentially everywhere and it's a very bare proof of concept for a fully integrated programming development system.
The problem is that things just take time if you have to coordinate across a bunch of languages and teams while trying to make everyone happy.
To give you a sense of what else is coming: the wasm ecosystem is moving towards supporting a component model. Eventually you'll be able to import any piece of code from any programming language that supports it. Wasm interface types will make that possible.
9.
Show HN: Dart Live – compiler, VM, analyzer and hot reload on the web via WASM(modulovalue.com ↗)
3 points · by modulovalue · 6mo ago · discuss
comment 8mo ago · link · parent
In the Dart/Flutter world, async iterables are known as streams. The biggest problem is that they are asynchronous so if you derive new streams from existing streams, you won't have a value immediately for those streams available, you'll have to wait a frame for values to propagate. That's not a problem if you're just processing data, but if you're using them in a UI framework and your UI framework is coupled to the event loop, then you have a problem.
This doesn't happen with the ReactiveX approach because things are evaluated immediately, one doesn't have to wait for the event loop to tick. (A fun historical artifact is that ReactiveX has not caught on in the Dart/Flutter community around 2019-ish because it was eventually migrated to use Streams and the initial-value-problem was a real problem that made the benefits of ReactiveX not carry its weight nobody noticed that but I was heavily involved and I am still using a custom framework derived from my observations back then).
If we zoom out a bit, the problem is actually that we are trying to define a computation graph and then need a strategy for evaluation it. I think Elm has actually made the biggest progress on that front (here's THE talk on that topic that shows how complicated working out all the kinks can be: https://www.youtube.com/watch?v=Agu6jipKfYw)
I still think that functional reactive programming solves most of the problems we have in UI-land, but the complexity that we have to deal with when we use traditional methods of state mutation, that complexity becomes enormous when trying to define a reactive programming framework, especially in languages that are not purely functional.
I think in 10 or 20 years there will be somebody that solves this problem, I don't see it happening anytime soon, sadly. It's just too complicated and we need programming languages that are built around those ideas for them to become comfortable enough to be usable in practice.
11.
243,000 words dictated in 39 days, speech-to-text changed how I work(modulovalue.com ↗)
3 points · by modulovalue · 9mo ago · discuss
13.
I built a 2x faster lexer, then discovered I/O was the real bottleneck(modulovalue.com ↗)
187 points · by modulovalue · 10mo ago · 92 comments
14.
Benchmarking my parser generator against LLVM: I have a new target(modulovalue.com ↗)
3 points · by modulovalue · 10mo ago · discuss
15.
I built a 2x faster lexer, then discovered I/O was the real bottleneck(modulovalue.com ↗)
5 points · by modulovalue · 10mo ago · 1 comment
16.
Statistical Methods for Reliable Benchmarks(modulovalue.com ↗)
1 points · by modulovalue · 10mo ago · discuss
17.
The Case for Snake Case: A Kolmogorov Complexity Argument(modulovalue.com ↗)
2 points · by modulovalue · 11mo ago · 1 comment
18.
Show HN: Concepts Reader, a Backup Plan for My Life(modulovalue.com ↗)
2 points · by modulovalue · 11mo ago · discuss
19.
Understanding Dart Class Modifiers by Using Lattices(modulovalue.com ↗)
1 points · by modulovalue · 11mo ago · discuss
comment 1y ago · link · parent
The idea of an index is more general, as an index can be built for many different domains. For example, B-trees can index monoidal data and inverted indexes are just an instance of such a monoid that a B-tree can efficiently index.
Furthermore, metric spaces (e.g., levenshtein distance) can also be efficiently indexed using other trees: metric trees. So calling inverted indexes just indexes would be really confusing since string data is not the only kind of data that a database might want to support having efficient indexes for.
comment 1y ago · link · parent
Monoids are a key idea in computer science and I think that everyone should know what monoids are. Monoids are EVERYWHERE and once you recognize that you have a monoid you can immediately use known methods to compute over monoids in efficiently (e.g. https://static.googleusercontent.com/media/research.google.c...).
Once you have a certain lattice (I'm leaving out some details), you can solve problems efficiently by known methods (e.g. using dataflow solvers) and automatically have a proof that the solution always terminates.
I really wish that more people took their time to learn these fundamentals and I think this is a wonderful introductory site. I don't mean to offend anyone, but if you've never heard of most of that stuff, then I think that you don't deserve to call yourself a professional programmer. Why? You will reinvent solutions to problems that have been solved before much more efficiently then you will be able to i.e. you're an amateur.
comment 2y ago · link · parent
It's on my todo list to 3d print some containers to replace the bags with actual "money rolls" so that I can remove them more easily.
comment 2y ago · link · parent
There was a time in my life when my legs started hurting and shaking from muscle atrophy because I was programming too much and moving too little.
I was looking for a way to fix that issue and I didn't want to waste time going to a gym, so I started talking walks with a weighted vest. Walking is nice because you can think while walking and with a weighted vest you don't have to walk for hours for it to have a useful effect on your body.
comment 2y ago · link · parent
When I started doing this I didn't want to afford dedicated weights as it seemed like a waste of money, but I had many cents saved up from my childhood, which I started to use instead.
I have roughly 15kg in euro cents in my vest and I'm regularly talking walks with it.
To get one kilo you need 435 cents and it turns out that in Germany you can also "buy" coins "for free" at the "Bundesbank", that is, you can exchange actual money for weights without any fees. You give 4 euros and 35 cents and you get a kilo. Once you need the money back, you can also sell those coins back to them for free.
comment 2y ago · link · parent
That's an interesting perspective that I haven't considered before, thank you.
Now I'm wondering, could we throw away some information in just the right way and still maintain associativity? That is, it doesn't seem like throwing information away is fundamentally what's preventing us from having an associative operation, since we can throw information away and still maintain associativity by, for example, converting each summand to a 0 and adding them, and that operation would be associative. However, we would have thrown all information away, which is not useful, but we would have an associative operation.
comment 2y ago · link · parent
It seems to me that non associative floating point operations force us into a local maximum. The operation itself might be efficient on modern machines, but could it be preventing us from applying other important high level optimizations to our programs due to its lack of associativity? A richer algebraic structure should always be amenable to a richer set of potential optimizations.
---
I've asked a question that is very much related to that topic on the programming language subreddit:
"Could numerical operations be optimized by using algebraic properties that are not present in floating point operations but in numbers that have infinite precision?"
https://www.reddit.com/r/ProgrammingLanguages/comments/145kp...
The responses there might be interesting to some people here.
comment 2y ago · link · parent
Dart's static type system has been designed to avoid such problems.
Not once have I had, or heard of, a performance issue related to the Dart type checker. That's also one of the reasons why hot reload always works as expected.
comment 2y ago · link · parent
rfw is used by Google's Gemini LLM to generate UI.
rfw runs on the web/android/ios/macos/linux/windows, anywhere where Flutter runs.
comment 2y ago · link · parent
It uses Dart instead of Scala.