You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Damien Cram <da...@gmail.com> on 2010/12/22 10:47:43 UTC

A time delay in ModelFactory.createDefaultModel() ?

Hi all,

I can't figure out why the creation of a model (Model model =
ModelFactory.createDefaultModel()) takes some time (around half a second)
when it is executed for the first time. From the second time on, it is
almost instantaneous, as expected.

Is there any way to create an empty model faster ?

Thanks in advance,

Damien

Re: A time delay in ModelFactory.createDefaultModel() ?

Posted by Andy Seaborne <an...@epimorphics.com>.
The costs will usually be on a call to ModelFactory.createDefaultModel() 
because that's the first point the application calls into Jena code. 
Until then it's "just" declarations.

	Andy

On 22/12/10 11:21, Damien Cram wrote:
> Ok, this is probably due to class loading indeed.
>
> This half-second is a little bit annoying in my case, but I will try to
> ensure that required Jena classes are loaded prior to creating the model, at
> a time when this short delay is not an issue.
>
> Thanks for your advice.
>
> Damien
>
> 2010/12/22 Chris Dollin<ch...@epimorphics.com>
>
>> On Wednesday, December 22, 2010 09:47:43 am Damien Cram wrote:
>>
>>> I can't figure out why the creation of a model (Model model =
>>> ModelFactory.createDefaultModel()) takes some time (around half a second)
>>> when it is executed for the first time. From the second time on, it is
>>> almost instantaneous, as expected.
>>
>> I expect its loading the classes required.
>>
>>> Is there any way to create an empty model faster ?
>>
>> You'll have to pay the class-loading price at /some/ time.
>>
>> Maybe caching the classes on a RAM disc?
>>
>> Is that half-second a real problem?
>>
>> Chris
>>
>> --
>> "The process will be long and ... unreliable."                 Box, /Star
>> Cops/
>>
>> Epimorphics Ltd, http://www.epimorphics.com
>> Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
>> 6PT
>> Epimorphics Ltd. is a limited company registered in England (number
>> 7016688)
>>
>
>
>

Re: A time delay in ModelFactory.createDefaultModel() ?

Posted by Damien Cram <da...@gmail.com>.
Ok, this is probably due to class loading indeed.

This half-second is a little bit annoying in my case, but I will try to
ensure that required Jena classes are loaded prior to creating the model, at
a time when this short delay is not an issue.

Thanks for your advice.

Damien

2010/12/22 Chris Dollin <ch...@epimorphics.com>

> On Wednesday, December 22, 2010 09:47:43 am Damien Cram wrote:
>
> > I can't figure out why the creation of a model (Model model =
> > ModelFactory.createDefaultModel()) takes some time (around half a second)
> > when it is executed for the first time. From the second time on, it is
> > almost instantaneous, as expected.
>
> I expect its loading the classes required.
>
> > Is there any way to create an empty model faster ?
>
> You'll have to pay the class-loading price at /some/ time.
>
> Maybe caching the classes on a RAM disc?
>
> Is that half-second a real problem?
>
> Chris
>
> --
> "The process will be long and ... unreliable."                 Box, /Star
> Cops/
>
> Epimorphics Ltd, http://www.epimorphics.com
> Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
> 6PT
> Epimorphics Ltd. is a limited company registered in England (number
> 7016688)
>



-- 
*Damien Cram*
27, rue Saint-Jean - 69005 Lyon
Tél. 06 72 64 07 30

Re: A time delay in ModelFactory.createDefaultModel() ?

Posted by Chris Dollin <ch...@epimorphics.com>.
On Wednesday, December 22, 2010 09:47:43 am Damien Cram wrote:

> I can't figure out why the creation of a model (Model model =
> ModelFactory.createDefaultModel()) takes some time (around half a second)
> when it is executed for the first time. From the second time on, it is
> almost instantaneous, as expected.

I expect its loading the classes required. 

> Is there any way to create an empty model faster ?

You'll have to pay the class-loading price at /some/ time. 

Maybe caching the classes on a RAM disc?

Is that half-second a real problem?

Chris

-- 
"The process will be long and ... unreliable."                 Box, /Star Cops/

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)

Re: A time delay in ModelFactory.createDefaultModel() ?

Posted by Dave Reynolds <da...@gmail.com>.
On Wed, 2010-12-22 at 10:47 +0100, Damien Cram wrote: 
> Hi all,
> 
> I can't figure out why the creation of a model (Model model =
> ModelFactory.createDefaultModel()) takes some time (around half a second)
> when it is executed for the first time. From the second time on, it is
> almost instantaneous, as expected.

Not something I've noticed.

What platform are you running on?

One guess is that you are seeing the class loader delay involved in
loading large parts of Jena the first time (part of the Java price tag)
rather than any actual processing.

> Is there any way to create an empty model faster ?

No.

Dave