Re: [xsl] is there a way to hash an element?

Subject: Re: [xsl] is there a way to hash an element?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 11 Jun 2016 17:21:01 -0000
Hi Graydon,

> Hi Dimitre --
>
> deep-equal() works beautifully as a test but it doesn't provide a
> grouping mechanism.  Going through n thousand structures pairwise just
> can't be optimal.

Actually, I believe that calling deep-equal() can be more efficient
than comparing hashes.

The reason is simple: deep-equal() most probably returns false at the
first possible moment -- for example, noticing that an element has
different attributes than its counterpart.

On the other side, with hashing,  the hashes for the two whole
subtrees have to be calculated and only after that they can be
compared.

To summarize, with the exception of the case when the two subtrees are
equal, deep-equal may perform faster than generating and comparing
hashes on the subtrees.

Cheers,
Dimitre

On Fri, Jun 10, 2016 at 2:45 PM, Graydon graydon@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Jun 10, 2016 at 02:27:30PM -0000, Dimitre Novatchev dnovatchev@xxxxxxxxx scripsit:
>> I would also try to use the standard XPath 2.0 function:
>>
>>     deep-equal()
>>
>> Yes, it doesn't generate an id for identifying a sub-tree, but still
>> can be used for establishing classes of equivalence.
>>
>> Just a quick thought.
>
> Hi Dimitre --
>
> deep-equal() works beautifully as a test but it doesn't provide a
> grouping mechanism.  Going through n thousand structures pairwise just
> can't be optimal.
>
> -- Graydon, who wrote the initial very small test case using
> deep-equal()
> 



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread