-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pdPackager: further improve node read/write performance
Two major changes here. 1) As much as possible, I've tried to rework pdPackager to not require intermediary arrays when reading/writing, and/or compressing/decompressing node data. This is made possible by new interaction functions with the underlying buffer class, which allow us to use naked pointers and pre-allocated buffers whenever possible, avoiding the need for interop via VB arrays. 2) Raster layers in PDI files were another opportunity for optimizations, as we must pre-allocate a DIB prior to extracting the actual pixel data from file. Historically, pixel data had to be extracted into a temporary array at its compression size, decompressed into a new array at its decompression size, then finally copied into the pre-allocated DIB. Besides wasting a huge amount of memory, it's time-consuming to repeatedly allocate large chunks of memory (50+ MB for a standard photo), allocations that are further compounded when loading images with multiple layers. But no more! Now, pdPackager exposes some (explicitly marked as dangerous) functions for circumstances when an external buffer can be safely pre-allocated, independent of pdPackager. When this happens, it can now perform a blind extraction+decompression directly from the master pdPackage buffer (typically compressed) to a caller-allocated buffer (like a DIB, in PD's case). Temporary buffers are no longer required or allocated, but obviously, these functions are only valid for circumstances where the caller can use other information (in our case, DIB stride, height, color depth) to pre-allocate a correctly sized buffer independent of pdPackage's internal measurements. Anyway, the take-home message is that PDI reading+writing is now much faster, which is particularly great for improving responsiveness of the Undo/Redo stack.
- Loading branch information
1 parent
4d0244e
commit 1090def
Showing
6 changed files
with
288 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.