aseprite / aseprite/Attachment-System

Optimize save time

Open
#54 2 comments 0 reactions 1 assignee Claimed by @dacap View on GitHub
feature high priority
Dominant language
Lua
Stars
8
Forks
2
PR merge metrics
No merged PRs in 30d

Description

We should make the *File > Save* operation faster, mainly for the purpose of this extension, i.e. saving huge animations created with attachments (big tiles and tilemaps of 1x1).

To do so we can think that a regular operation using the Attachment System will be as follows:

1. Most of the time saving changes in anchors/reference points or adding frames re-using attachments
2. Adding new attachments
3. Big attachments with borders that can be shrunk (a lot of space/pixel data to be saved)
4. Few attachment modifications after they are created (probably an attachment, once it's created, will not be modified in its entire lifetime)

Some tasks/ideas to improve the saving performance depending on these use cases (from simplest to the most complex):

- [x] First of all profile the save operation to check what is the main bottleneck saving this kind of files, then decide how to continue
- [ ] Using indexed color mode? // User-side workflow change, we're not sure if this is possible
- [ ] Cache the loaded tile from the .aseprite file and save the exact same bytes if the tile is not modified (no need to re-compress the data if it wasn't modified) // more memory usage when editing the sprite
- [x] Cache the whole tileset? E.g. Caching the whole tileset chunk to re-save it as-is (if we cache all tiles I think this will not add too much)
- [ ] Save a shrunken version of each tile/attachment (removing all unused borders)
- [ ] Add support for uncompressed tilemaps? As we have 1x1 tilemaps // as a prerequisite we need to remove all empty tiles (shrink the tilemap) in the extension first
- [ ] Compressing images/tiles in parallel (multiple threads compressing images in the save process)
- [ ] External tilesets: From aseprite/aseprite#977 there are plans to support external tilesets, but it's a big refactor/it might take several weeks of work/testing and we're not 100% sure if this alone will improve the performance to save files (e.g. the only way to optimize the save time using this is caching the tileset / not saving the external tileset when it's not modified)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.