A Curious Case of Slow USD Import in Blender
A developer encountered unexpectedly slow import times when importing USD scenes into Blender. Profiling revealed the bottleneck to be Blender's internal ID sorting function, `id_sort_by_name`. This function, expected to be O(N), degraded to O(N^2) due to the naming scheme in the USD files. By modifying the naming convention and optimizing the sorting algorithm, the developer reduced import times from 4 minutes 40 seconds to 8 seconds for smaller files. However, the underlying issue stems from Blender's requirement for sorted IDs, leading to suggestions for replacing the linked list with a Trie or hash table. This optimization highlights a common challenge in performance tuning: identifying and addressing unexpected complexity.