public override object Execute(IContextProvider provider, object[] args, MemoryPool pool) { XQueryNodeIterator res = (XQueryNodeIterator)pool.GetData(_cache); if (res != null) return res.Clone(); #if PF PerfMonitor.Global.Begin(this); #endif XQueryNodeIterator rootIter = XQueryNodeIterator.Create(_path[0].Execute(provider, args, pool)).CreateBufferedIterator(); bool orderedSet = _isOrderedSet && rootIter.IsSingleIterator; res = new ResultIterator(this, provider, orderedSet, !orderedSet & QueryContext.EnableHPC, rootIter, args, pool); if (EnableCaching) { res = res.CreateBufferedIterator(); pool.SetData(_cache, res.Clone()); } #if PF PerfMonitor.Global.End(this); #endif return res; }