Open IoeCmcomc opened 2 months ago
Thank you for the pull request! These are some great improvements. I'm gonna review it soon, but since it touches some vital parts of the NBS workflow, I'd like to make sure everything works as expected before merging :)
Ready to merge if no problems are found. I updated the first comment, so please re-read it.
This pull request aims to improve the performance of selection-related actions, macro operations and song loading. It also allows users to undo and redo macro changes.
Changes
array_to_selection()
,selection_code_update()
,selection_load()
,selection_load_ext()
,selection_to_array()
,region_code_get()
andregion_code_load()
to utilize buffers because buffer functions are much faster than string functions.TheTheselection_code
string is kept uncompressed.selection_code
variable is also compressed as well. Selection code (de)compression is implemented intry_compress_selection()
andtry_decompress_selection()
. (De)compression overhead is insignificant. A selection code will not be compressed if the compressed string is longer than the original string or if the original string is short (less than 16 characters).if else
statements inaction_undo()
andaction_redo()
withswitch case
statements.array_length(arr_data)
instead ofstring_count("|", str)
to calculatetotal_vals
; usemacro_column_count()
to replacestring_count("-1", ...)
in some macros;Alt
is pressed.script_execute()
, and disable surface depth.@
accessor or turning off copy-on-write. Because copy-on-write is a project-wide option that will affect all arrays in the program, I decided to keep it on;selection_exists
array to separate functions.array_grow_then_set()
to set a value at an index to an array and grow the array by the factor of 1.5 when necessary, which should give a better time complexity thanarray_push()
.Bugfixes