mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-28 10:11:58 +01:00
swatches.import named each imported group with unique_group, which compares a candidate name with the library's groups one by one and tries "Name", "Name 1", "Name 2" and so on until one is free. Groups without a name all take the import's group name, so a file of n unnamed groups cost about n^3/6 string comparisons. In a test build, importing a file of 9,994 unnamed groups took about 4.5 minutes. The import now builds the set of the library's group names once and keeps the next number to try for each repeated name, as it already does for swatch names. Group numbers still start at 1, and groups get the same names as before. unnamed_groups_are_numbered_in_linear_time imports such a file on a thread of its own and fails when the import takes more than 20 seconds. repeated_group_names_take_the_first_free_number checks the names when a group in the file has a name that the import already gave to an earlier group.