[xquery-talk] Is it possible to maintain a list of value in XQuery

daniela florescu dflorescu at me.com
Wed May 15 13:32:04 PDT 2013

On May 15, 2013, at 1:05 PM, David Lee wrote:

> Wow ... I really hoped our ivory tower was immune from personal attacks.... what's up with today a full moon crossing mars?

I just said the code is ugly and potentially slow.

I am attacking the coding style, not the author.  (and BTW, given the design of XQuery, there is no way to write it other way, so it's
definitely not the fault of the author. And by the way, a lot of the design of XQuery is my fault... so why would I complain?)

> If *anyone* on this list, or the entire world for that matter, knows about program optimization I would put Mike at the top of the list, higher than anyone I know personally and likely higher than anyone I know via Nth relation.

I can tell you the world is full of query optimizer experts, that probably know XQuery in and out, and SQL optimization in and out, and 
compiler technology in and out, and functional language compilation, and that you probably never met. 
Not everybody who knows something writes a lot of emails on public mailing lists, that's all.

There is a 30 years old history of optimizing SQL, or compiling functional languages, and lots of people did lots of things, even if you do 
not know about it.

( But I agree that nobody knows XML as well as Mike. I would defer all questions about the details of XML to him....)

> So could we stop that and get back to decency ?  XQuery itself is efficient or not based in the implementation, not the language.

>  And yes some optimizations are hard, possibly so hard they never get done or only done by <exclude my favorite prrocessor>

No, I am afraid you do not understand what I am trying to say.

Not that certain optimizations are HARD. Hard you can deal with. You just sit down and do it.

In optimization in general it is IMPOSSIBLE to get it PERFECT (and I have some 25 years of experience with compilers and query optimization, so I think
I know something about it).

An optimization is extremely rarely something that you apply and BOOM, your programs (all of them) are faster. Almost NONE are like this.

There is always a compromise to be made. For some programs that you make faster there are ALWAYS others that you make slower.

This is why optimization is the delicate art of choosing wisely a compromise that would work well IN AVERAGE (whatever that means..).

This is why you need heuristics, for the SPECIAL cases when the user knows better then the compiler -- and there are always cases like this--
and then he/she should have the possibility to say: "Here, I would like my program to be executed THIS way".

Most of the time you will trust a smart optimizer, but not always.

That's what an assignment is. A heuristic.

> As for the ugliness of XQuery code ... point taken.  XQuery is not always pretty ... but then it has many flavors. 
> I personally find it beautiful.
> I am sure one could come up with prettier code.  Although I myself don't see any ugliness in the code  I wrote,
> and don't see how it would be prettier in a procedural fashion ... or why it matters to the poster ...
> Was subjective beauty part of the prerequisite ?
> And the question was asked about XQuery, not XQuery + (Add feature X We are proud of but isn't XQuery)
> Might as well jump to C or Java or Haskell or <insert your favorite language that isnt XQuery>

Thanks for liking XQuery ! Given that it looks 90% as the language that bears my design (Quilt, with Jonathan Robie 
and Don Chamberlin) and that it is a functional language because of me (probably), I am certainly taking it as a compliment :-)))

So don't get me wrong, I like it too :-)

It's just that, like any other programming language, is not 100% perfect.


More information about the talk mailing list