Laurens has made the relevant changes to get ONNX-YOLO face detection
working in a manner where the generated embeddings are the same as what
get generated by the corresponding ML stack in the mobile client.
This PR cherry picks his ML related changes from the branch he was
working in, but leaves out the surrounding scaffolding (We cannot merge
that branch directly because it relies on wasm that we don't need and
don't want to commit to main).
At this point this functionality is correct but not usable - the next
step will be to tie this to the ONNX runtime that we already have on the
Node.js layer of our desktop app.
**Tests**
- yarn dev + smoke test
- yarn build + smoke test
- yarn lint
## Description
- Migrated from `sqflite` to `sqlite_async` when fetching files for
gallery (Home gallery, Collections page, Archive page & Add photos sheet
gallery ). This has made gallery load significantly faster and has
gotten rid of logs like `NativeAlloc concurrent copying GC freed
392872(19MB) AllocSpace objects, 139(4024KB) LOS objects, 38% free,
38MB/62MB, paused 2.868ms,93us total 324.898ms`. The initial load(100
files) and final load completes instantaneously even before the user
starts interacting with the app which has gotten rid of the jank which
was present before on the final load.
- In the 'Add Photos sheet', it takes time for the gallery to load when
using `sqflite` and images are rendered after this delay. After
migrating to `sqlite_async`, since the gallery loads instantly and
images are rendered right after, the animation of the bottom sheet
coming up became a bit janky. To make it smooth, have added a delay to
load gallery only after the bottom sheet is up fully.
## Tests
- [x] Did basic testing to make sure the migrations are working fine.
Laurens has made the relevant changes to get ONNX-YOLO face detection working in
a manner where the generated embeddings are the same as what get generated by
the corresponding ML stack in the mobile client.
This commit cherry picks his ML related changes from the branch he was working
in, but leaves out the surrounding scaffolding (We cannot merge that branch
directly because it relies on wasm that we don't need and don't want to commit
to main).
At this point this functionality is correct but not usable - the next step will
be to tie this to the ONNX runtime that we already have on the Node.js layer of
our desktop app.
Fixes the following error on the nightly build
Error: Attempting to assert globalThis.electron in a non-electron
context
at r
(/home/runner/work/ente/ente/web/apps/photos/.next/server/chunks/676.js:1:25418)
...
> Build error occurred
Error: Failed to collect page data for /gallery
at
/home/runner/work/ente/ente/web/node_modules/next/dist/build/utils.js:1258:15
{
type: 'Error'
}
Fixes the following error on the nightly build
Error: Attempting to assert globalThis.electron in a non-electron context
at r (/home/runner/work/ente/ente/web/apps/photos/.next/server/chunks/676.js:1:25418)
...
> Build error occurred
Error: Failed to collect page data for /gallery
at /home/runner/work/ente/ente/web/node_modules/next/dist/build/utils.js:1258:15 {
type: 'Error'
}
## Description
Using [sqlite_async](https://pub.dev/packages/sqlite_async) has
increased query speed by about 5x and has removed GC logs like:
`Background concurrent copying GC freed 424845(20MB) AllocSpace objects,
183(4932KB) LOS objects, 37% free, 39MB/63MB, paused 144us,44us total
128.048ms`, which has improved performance of the app.
Tried using [sqlite3](https://pub.dev/packages/sqlite3), which reduced
query speed by 10x and removed the GC log, but introduced some jank
since it blocks the UI.
Converting the fetched rows to `EnteFile` now runs on an isolate to
avoid blocking the UI.
## Tests
Did manual testing to see difference in jank.