* Change Address the poor performance of the existing unique-name generation As described in Issue 16849, the existing Tools::getUniqueName method requires calling code to form a vector of existing names to be avoided. This leads to poor performance both in the O(n) cost of building such a vector and also getUniqueName's O(n) algorithm for actually generating the unique name (where 'n' is the number of pre-existing names). This has particularly noticeable cost in documents with large numbers of DocumentObjects because generating both Names and Labels for each new object incurs this cost. During an operation such as importing this results in an O(n^2) time spent generating names. The other major cost is in the saving of the temporary backup file, which uses name generation for the "files" embedded in the Zip file. Documents can easily need several such "files" for each object in the document. This is the first part of the correction, adding an efficient class for managing sets of unique names. New class UniqueNameManager keeps a list of existing names organized in a manner that eases unique-name generation. This class essentially acts as a set of names, with the ability to add and remove names and check if a name is already there, with the added ability to take a prototype name and generate a unique form for it which is not already in the set. a new unit test for UniqueNameManager has been added as well. There is a small regression, compared to the existing unique-name code, insofar as passing a prototype name like "xyz1234" to the old code would yield "xyz1235" whether or not "xyz1234" already existed, while the new code will return the next name above the currently-highest name on the "xyz" model, which could be "xyz" or "xyz1" or "xyz0042"..
33 lines
1.4 KiB
CMake
33 lines
1.4 KiB
CMake
target_sources(
|
|
Tests_run
|
|
PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Axis.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Base64.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Bitmask.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/BoundBox.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Builder3D.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CoordinateSystem.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/DualNumber.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/DualQuaternion.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Handle.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Matrix.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Parameter.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Placement.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Quantity.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Reader.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Rotation.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/ServiceProvider.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Stream.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/TimeInfo.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Tools.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Tools2D.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Tools3D.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/UniqueNameManager.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Vector3D.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/ViewProj.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Writer.cpp
|
|
)
|
|
|
|
setup_qt_test(InventorBuilder)
|