IBM DOORS DXL: Text search performance


This page provides a comparison of the performance (runtime) of various DXL string search functions.




Performance Comparison

Goal: Measure the runtime of a variety of DXL text search functions.
Task: Find the text 'The SW shall' in a DOORS module. Repeat the task 100 times for a meaningful runtime measurement.
Environment: IBM DOORS version 9.6.1


Module 1Module 2Module 3Module 4
Count of objects in module:952126021161852
findPlainText(stringObjectText, stringToFind, matchCase=TRUE):Found 55500 items in 484 msFound 24300 items in 703 msFound 89300 items in 1094 msFound 90200 items in 1140 ms
findPlainText(stringObjectText, stringToFind, matchCase=FALSE):Found 60700 items in 906 msFound 30700 items in 2250 msFound 96300 items in 2359 msFound 112000 items in 2234 ms
matches(stringObjectText, stringToFind):Found 55500 items in 531 msFound 24300 items in 719 msFound 89300 items in 1188 msFound 90200 items in 1250 ms
contains(buffer, stringToFind):Found 55500 items in 375 msFound 24300 items in 516 msFound 89300 items in 859 msFound 90200 items in 922 ms
keyword(buffer, stringToFind):Found 55500 items in 391 msFound 24300 items in 531 msFound 89300 items in 922 msFound 90200 items in 922 ms
regex(buffer, regexToFind):Found 55500 items in 406 msFound 24300 items in 516 msFound 89300 items in 890 msFound 90200 items in 937 ms
search(buffer, regexToFind):Found 55500 items in 406 msFound 24300 items in 515 msFound 89300 items in 907 msFound 90200 items in 954 ms





Conclusion

The DXL standard library function contains() is the fastest method to search text within a DOORS module.
However, its use requires mastering the creation, allocation and deletion of buffers.

The DXL standard library function search() gets an honorable mention for its versatile capability.
It accepts regular expressions and has equally fast runtime.

The DXL standard library function findPlainText() in conjunction with option matchCase = false has the worst runtime.
Which was to be expected.





Example script to find text using DXL function contains()


// disble 'runtime too long' error message
pragma runLim, 0
Buffer objectTextBuffer = create(); Object o = null; string searchString = "The SW shall"; const int loopMax = 100; const int searchStartPosition = 0; int index = 0; int result = 0; int occurrences = 0;
// iterate over all objects in current open module for o in current do { // copy object text to buffer objectTextBuffer = o."Object Text";
// call the search function // the function returns '-1' if searchString was not found in objectTextBuffer // use argument 'searchStartPosition' to search from a specific position in objectTextBuffer result = contains(objectTextBuffer, searchString, searchStartPosition);
if (result >= 0) { occurrences = occurrences + 1; } }
print("Found " occurrences " occurrences \n");
delete(objectTextBuffer);





Download


Tested with IBM DOORS version 9.6.1
Open any module
Goto Menu -> Tools -> Edit DXL...
Paste DXL script test-string-search-speed.dxl into the editor and click the 'Run' button