Hello BaseX Staff,

Question regarding why the time complexity of my query is dramatically different in these 2 situations. I'm building a map inside a function that is called many times, and this function receives an ID and then has to retrieve some values to store inside the map.



In case #1, I check if the values exists first, otherwise I store '()':
"lowerValue" : if (exists($context//packagedElement[@xmi:id=$currID]/ownedAttribute[@xmi:id=$propList[2 + $mult]]/lowerValue[@value]))
                             then data($context//packagedElement[@xmi:id=$currID]/ownedAttribute[@xmi:id=$propList[2 + $mult]]/lowerValue/[@value])
                             else (),
              "upperValue" : if (exists($context//packagedElement[@xmi:id=$currID]/ownedAttribute[@xmi:id=$propList[2 + $mult]]/upperValue[@value]))
                             then data($context//packagedElement[@xmi:id=$currID]/ownedAttribute[@xmi:id=$propList[2 + $mult]]/upperValue/[@value])
                             else ()
Total Time: 1526.0
In case #2: