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

Create repository for database #42

Closed
MarcelGarus opened this issue Jul 3, 2020 · 1 comment
Closed

Create repository for database #42

MarcelGarus opened this issue Jul 3, 2020 · 1 comment

Comments

@MarcelGarus
Copy link
Owner

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:

  1. Write a low-level wrapper in another language, like Rust.
  2. 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.

@MarcelGarus
Copy link
Owner Author

Done, see https://github.com/marcelgarus/chest

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

1 participant