Using 10.6 on macOS:

I have a data file with elements like:

  <record language="en-US" family="pce-test-data" 
bundlename="bundle-appportman-application-portfolio-management" 
topicpath="product/application-portfolio-management/concept/application-portfolio-management-landing-page.dita"
 notviewed="viewed" viewcount="13579">

One such entry for each topic in our public docs server that is accessed at 
least once (Adobe page views data).

I generate a report for all the topics used from a root map that includes the 
page views data for each topic for which there is an entry.

The database with this data set is indexed with an attribute and a token index.

In my testing I’m finding that lookup using db:attribute() on the @topicpath 
attribute (which is always a single value) is about 10x slower than using 
db:token().

That is, I have this code:

$records := db:token($analyticsmgmt:analyticsDatabase, $docPath, 'topicpath')/..

When I run this for a set of about 1200 topics, the db:token version takes 
about 400ms but the db:attribute version takes 9 seconds!

I’m surprised at this result—I would expect the two forms of index to perform 
with the same speed: the attribute is a single blank-delimited token and I 
would expect the string match under the covers to be using the same code path.

But using the db:token database is clearly faster by a lot.

If I report the time each lookup uses, the times vary quite a lot, but for the 
token lookup they tend to be in the 10-60ms range, but for the attribute 
lookup, many are in the 1 or 2 second range, which explains the much longer run 
time.

I’m wondering if this result is expected due to implementation details of the 
attribute index as distinct from the token index or if this indicates some 
logic bug in the attribute index implementation.

Cheers,

E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> | 
Twitter<https://twitter.com/servicenow> | 
YouTube<https://www.youtube.com/user/servicenowinc> | 
Facebook<https://www.facebook.com/servicenow>

Reply via email to