Expression bound to unused variable still evaluated
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
Fix Committed
|
Medium
|
Markos Zaharioudakis |
Bug Description
import module namespace http = "http://
import module namespace file = "http://
import module namespace x = "http://
import schema namespace opt = "http://
let $xml-frags1 := x:parse(
<opt:options>
<opt:parse-
</opt:options>)
let $xml-frags2 := <a></a>
return $xml-frags2
(I will attach levels.xml, but its contents are not actually relevant I don't believe.)
Run this query, redirecting the output of Zorba to /dev/null to skip the time it takes to write the output. Then change "return $xml-frags2" to "return $xml-frags1" and run it again. You will see two things:
1. Both queries take basically identical lengths of time to run.
2. When running the first query, memory consumption ramps up throughout the execution, whereas with the second query memory stays at a consistent low point.
This implies two problems:
A. Zorba isn't skipping the evaluation of x:parse(
B. In that case, Zorba is actually parsing *and materializing* the input XML.
Fixing (A) would make (B) moot, but I really think we should understand why (B) is happening because it seems awfully strange.
Changed in zorba: | |
assignee: | nobody → Markos Zaharioudakis (markos-za) |
importance: | Undecided → High |
status: | New → Confirmed |
summary: |
- Compiler doesn't always eliminate unused code + Expression bound to unused variable still evaluated |
Changed in zorba: | |
milestone: | none → 3.0 |
Changed in zorba: | |
importance: | High → Medium |
Changed in zorba: | |
status: | Confirmed → Fix Committed |
Initial bug report and some follow-up discussion:
https:/ /groups. google. com/forum/ #!msg/zorba- users/f7YRINPw- A8/GeYmzblJVj0J