Re: Ann: SWI-Prolog 7.1.9

Jos De Roo <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <OF01252C96.5BE56FA9-ONC1257C8C.00837D30-C1257C8C.00839A5F@agfa.com>
Hi Jan,

Thanks for the very constructive answer, it really helped and
eye with --plugin is now loading at a speed of 125 Ktripes/sec
which is 3 times faster than yesterday :-)

> Hi Jos,
> 
> On 02/27/2014 12:38 AM, Jos De Roo wrote:
>> Hi Jan,
>>
>> With the attached file graph.n3p we get
>> $ swipl -f graph.n3p -g halt
>> % graph.n3p compiled 2.21 sec, 100,103 clauses
>>
>> Compared to version 6.6.1 this is a speed drop of 38%
>> $ swipl -f graph.n3p -g halt
>> % graph.n3p compiled 1.60 sec, 100,103 clauses
> 
> The original file didn't make it to the list because of
> the long attachment, but that doesn't matter too much.
> 
> Yes, compilation in 7.x is slower.  This is because there
> is more support for term/goal expansion/4, which includes
> translation the source location information.  The second
> reason is that the functional notation support requires
> analyzing the source in more depth.
> 
> If you want best speed for loading big Prolog data files,
> load them using a read/assert loop and finally call
> compile_predicates/1 to make the code static.  So,
> 
> ==
> load_file(File, Module) :-
>                setup_call_cleanup(
>                    open(File, read, In),
>                    read_file(In, Module),
>                    close(In)),
>                findall(Module:Name/Arity,
>                                ( predicate_property(Module:Head, 
dynamic),
>                                  functor(Head, Name, Arity)
>                                ), Preds),
>                compile_predicates(Preds).
> 
> read_file(In, Module) :-
>                read_term(In, T0, []),
>                read_file(T0, In, Module).
> 
> read_file(end_of_file, _, _) :- !.
> read_file(Term, In, Module) :-
>                assert_clause(Term, Module),
>                read_term(In, T2, []),
>                read_file(T2, In, Module).
> 
> assert_clause((:-_), _) :- !.
> assert_clause(Term, Module) :-
>                assertz(Module:Term).
> ==
> 
> 1 ?- time(load_file('graph.n3p', test)).
> % 401,925 inferences, 0.449 CPU in 0.449 seconds (100% CPU, 895476 Lips)
> 
> (vs. 1.5. seconds for consult).  The time is now 92% read_term and 7%
> assertz and 1% for the loop above.
> 
> And of course, there is the RDF database :-)  Did you compare the
> two in terms of loading time, storage space and query time?

No and I am feeling sorry about that ..

The thing is that we typically use graph literals (N3 formulae)
esp. in RESTdesc http://restdesc.org/about/concept proofs like
http://eulersharp.sourceforge.net/2007/07test/resto-proof.n3

Just to get an idea, loading the 100000 triples from graph.n3p
in EYE takes 0.809 sec and requires 500297 VM-codes.

>                Cheers --- Jan

Kind Regards,

Jos De Roo | Agfa HealthCare
Senior Researcher | HE/Advanced Clinical Applications Research
T  +32 3444 7618 | F  +32 3 444 8211 | M  +32 494 56 03 95

http://www.agfahealthcare.com
http://blog.agfahealthcare.com
R.O.: Septestraat 27, B-2640 Mortsel, Belgium | RLE Antwerp | VAT BE 
0403.003.524 | IBAN Operational Account BE81363012356224 | IBAN Customer 
Account BE20375104592856 | ING Belgium NV, B-1000 Brussels
Click on link to read important disclaimer: 
http://www.agfahealthcare.com/maildisclaimer 
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.