You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to tinker with building a rock-solid database based on tape.
I could think of two architecturally different approaches to a database:
Write a low-level wrapper in another language, like Rust.
Write everything in Dart.
Here, I want to shed some light on the tradeoffs of these two approaches.
Obviously, Rust itself is much more performant than Dart. Also, its advanced memory management features make it safe to quickly spawn lightweight threads operating on the same data structure instead of falling back on Dart's monolithic Isolate model and having to deal with message passing.
For example, that would make it possible to execute a query by spawning numerous threads that search the database in parallel.
Using a low-level wrapper also means we could use established database solutions like SQLite or indexdb.
These also provide amazing performance for queries as well as advanced indexing capabilities.
That being said, database performance is usually I/O-bound and Dart's RandomAccessFile would allow us to implement some indexing and query capabilities in Dart as well.
Together with spawning a separate isolate for each database instance, this would probably also result in reasonable performance, although probably a magnitude slower than a battle-tested native solution.
A great advantage of pure Dart, on the other hand, is that it doesn't require any native configuration or dealing with native build systems – the code automatically runs (almost) everywhere where Dart runs, be that Windows, Linux, MacOS, Android, iOS, or Fuchsia. Only web would need to be handled differently.
Writing everything in Dart would also mean less overhead dealing with the boundary between native code and Dart.
The text was updated successfully, but these errors were encountered:
I'd love to tinker with building a rock-solid database based on tape.
I could think of two architecturally different approaches to a database:
Here, I want to shed some light on the tradeoffs of these two approaches.
Obviously, Rust itself is much more performant than Dart. Also, its advanced memory management features make it safe to quickly spawn lightweight threads operating on the same data structure instead of falling back on Dart's monolithic
Isolate
model and having to deal with message passing.For example, that would make it possible to execute a query by spawning numerous threads that search the database in parallel.
Using a low-level wrapper also means we could use established database solutions like SQLite or indexdb.
These also provide amazing performance for queries as well as advanced indexing capabilities.
That being said, database performance is usually I/O-bound and Dart's
RandomAccessFile
would allow us to implement some indexing and query capabilities in Dart as well.Together with spawning a separate isolate for each database instance, this would probably also result in reasonable performance, although probably a magnitude slower than a battle-tested native solution.
A great advantage of pure Dart, on the other hand, is that it doesn't require any native configuration or dealing with native build systems – the code automatically runs (almost) everywhere where Dart runs, be that Windows, Linux, MacOS, Android, iOS, or Fuchsia. Only web would need to be handled differently.
Writing everything in Dart would also mean less overhead dealing with the boundary between native code and Dart.
The text was updated successfully, but these errors were encountered: