Skip to content

RWC: Rewrite core compiler in Rust #71

@b00skit

Description

@b00skit

First off, huge fan of the project. The paradigm shift of applying utility classes to database queries is exactly what the industry needs.

However, after reviewing the codebase, I noticed the query parser isn't leveraging the safety guarantees provided by the Rust borrow checker. While the current implementation works, we are leaving performance on the table.

The Proposal: I suggest we rewrite the core logic in Rust (using pg-sys bindings and tokio for the runtime).

Why?:

  • We can shave off at least 0.4ms during query string concatenation.
  • Currently, I’m not 100% sure that the SQL strings aren't leaking memory in the V8 heap. Rust guarantees that our SELECT * statements are memory safe at compile time.
  • If we ever need to generate 4 million queries per second on a Raspberry Pi, the current stack might bottleneck. Rust solves this.

I believe this should solve most of the issues open on this repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions