mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1185] Bulk sprite folder imports are slow due to per-file base64 upload and repeated list refresh #585
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#585
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Xelvanis on GitHub (May 25, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1185
Originally assigned to: @cha1latte on GitHub.
Summary
Bulk folder uploads for character/persona sprites are much slower than expected for larger sprite folders. The current flow processes one file at a time through browser base64 + Tauri IPC, then invalidates/refetches the full sprite list after every uploaded file.
Current behavior
Upload Folderin the character sprite tab and persona sprite tab loops through selected images sequentially.FileReader.readAsDataURL, then sent throughsprite_uploadas a base64 data URL.useUploadSpriteinvalidatesspriteKeys.list(characterId)after each successful upload.sprite_listreads every sprite file in the folder and returns every image as a base64 data URL.sprite_uploadalso decodes the incoming base64, writes the file, then reads and base64-encodes the saved file for the response.This makes a folder import with
Nimages trend toward repeated full-library work: upload one sprite, re-list/re-encode the growing sprite folder, upload the next sprite, repeat.Expected behavior
Bulk sprite folder import should import many files with progress, update the query/cache once or in controlled batches, and avoid re-reading/re-encoding the entire sprite library for every file.
Evidence / code paths
src/features/catalog/characters/components/CharacterEditor.tsx-handleFolderUploadsrc/features/catalog/personas/components/PersonaEditor.tsx-handleFolderUploadsrc/shared/hooks/use-sprites.ts-useUploadSpriteinvalidates the sprite list on every upload successsrc/shared/api/image-generation-api.ts-spriteApi.list/spriteApi.uploadsrc-tauri/src/commands/storage/commands/media.rs-sprite_list/sprite_uploadcommandssrc-tauri/src/commands/storage/sprites.rs-list_sprites,upload_sprite, andsprite_info_from_pathLikely bottlenecks
sprite_listreturns full base64 data URLs for every sprite, so every refresh scales with total sprite bytes.Existing better pattern nearby
SillyTavern bulk import already uses a native folder/path-token style flow with Rust-side scanning/copying and progress events:
src-tauri/src/commands/storage/imports/access.rssrc-tauri/src/commands/storage/imports/bulk_imports.rssrc/shared/api/import-api.tsSprite folder import would likely benefit from a similar native bulk command/event path instead of routing every image through browser base64 IPC.
Proposed direction
sprite_upload_bulkfor batched web uploads and/orsprite_import_folder_eventsfor native folder imports.spriteKeys.list(characterId)once after the bulk import completes, not once per file.{ imported, failed, sprites? }or progress events, including filenames/errors instead of silently swallowing failures.sprite_listto return metadata plus managed/local asset URLs instead of base64 image data. This is the bigger contract change but would improve editor load, roleplay overlays, game sprite lookup, tracker portraits, and slash-command sprite listing.Verification plan
full_prefix handling.pnpm typecheck,cargo check --manifest-path src-tauri/Cargo.toml, andpnpm check:architecturefor the implementation.Notes
This issue is based on code-path investigation. It still needs runtime timing measurements before/after implementation to quantify the improvement.
@cha1latte commented on GitHub (May 25, 2026):
Closed in #1201