prisma-engines icon indicating copy to clipboard operation
prisma-engines copied to clipboard

feat(js-connectors): create Wasm Query Engine, `query-engine-wasm-api`

Open jkomyno opened this issue 11 months ago β€’ 2 comments

This PR is based on the skyzh/wasm-connector-new branch of neondatabase/prisma-engines.

This PR depends on:

  • https://github.com/prisma/prisma-engines/pull/4095

It implements:

  • a new crate, query-engine-wasm-api, that is a Query Engine compatible with wasm32-unknown-unknown
  • a new crate, wasm-connectors, which implements the wasm-compatible Proxy andΒ JsQueryable structs equivalent to their napi.rs counterparts in js-connectors. Lots of code is duplicated between these two modules right now. Eventually, we should unify it and use compile-time conditional flags when necessary.
  • Wasm support for the smoke tests

This PR will be used as a middle point between the current main branch of prisma/prisma-engines (as of https://github.com/prisma/prisma-engines/commit/3b74ba351abfefd10f3da2b8af3c7ed7658f8d30) and https://github.com/prisma/prisma-engines/pull/4117.


You can build a Wasm query engine via:

  • cargo build -p query-engine-wasm-api --target wasm32-unknown-unknown --release

jkomyno avatar Aug 07 '23 22:08 jkomyno

CodSpeed Performance Report

Merging #4118 will degrade performances by 15.26%

:warning: No base runs were found

Falling back to comparing jkomyno/wasm-connector-new (75066a6) with jkomyno/quaint-wasm (53d95f8)

Summary

❌ 3 regressions βœ… 8 untouched benchmarks

:warning: Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark jkomyno/quaint-wasm jkomyno/wasm-connector-new Change
❌ validate (medium) 58.3 ms 66.4 ms -12.21%
❌ validate (small) 8.1 ms 9.5 ms -15.26%
❌ validate (large) 270.4 ms 298.4 ms -9.37%

codspeed-hq[bot] avatar Aug 07 '23 23:08 codspeed-hq[bot]

I have refined the previous pull request to include all the changes outside of the WASM module, so that this PR's scope will only be adding the two new crates and it would be easier to rebase / merge :) https://github.com/prisma/prisma-engines/pull/4117

skyzh avatar Aug 09 '23 17:08 skyzh