On Jan 17, 2013, at 12:52 AM, Andy Seaborne wrote:

> On 16/01/13 01:02, Holger Knublauch wrote:
>> Hi Andy,
>> 
>> I ran a profiler through a typical scenario with our software and
>> discovered that 10% of the clocked time was spent in the initialization
>> of the xsd:dateTime literal needed by the afn:now() and NOW function.
>> Below is a snapshot from Yourkit profiler.
>> 
>> 
>> 
>> Unless this is a measurement error in the tool, I believe there would be
>> a low-hanging fruit to optimize performance if the value would be
>> computed on demand only. I do understand that you need to get the time
>> stamp for the duration of the whole query, but I believe it would be
>> much faster to simply get the current time millis as a long, and from
>> this derive the actual XSD literal only if someone really calls this
>> SPARQL method.
>> 
>> Thanks
>> Holger
>> 
> 
> Holger,
> 
> This isn't clear to me - I can not see the code context for the call to 
> NodeFactory.nodeAsDateTime.
> 
> what is the SPARQL query being executed?

Any QueryExecution. The relevant call tree starts in the class Context:
        
    context.set(ARQConstants.sysCurrentTime, NodeFactory.nowAsDateTime()) ;

My suggestion is to use a different constant such as sysCurrentTimeMillis for a 
simple long and compute the sysCurrentTime on demand only, on the first call of 
the now function.

HTH
Holger

Reply via email to