On Tuesday, September 13, 2011 05:07:00 AM Clifford Yapp wrote: > I am trying to compare two large lists of file paths (about 14,000 lines > each) to identify which entries in each list are missing from the other, > and while I can get CMake to do it I must be doing it the wrong way > because the results are hideously slow. > > I currently generate two files with the paths and then read them in as > lists, using LIST() commands to peform STREQUAL tests. I was hoping to
How do you do that ? Do you iterate over one list using foreach() and then list(FIND) to check whether it exists in the other list ? Internally, every cmake variable is stored as a plain std::string. When using a list() command, this string is converted to a std::vector<std::string>, and then cmake operates on this vector. So if you do this 14000 times, each time a 14000 std::strings are created, which makes this O(n^2) I think. Maybe something like this works ? set(uniqueItems ${list1} ${list2}) list(REMOVE_DUPLICATES uniqueItems ) Or maybe you can do something with sorting both lists first. Alex _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake