Giter Club home page Giter Club logo

Comments (3)

afs avatar afs commented on July 22, 2024

JIT costs?

from jena.

rvesse avatar rvesse commented on July 22, 2024

JIT costs?

Possibly, this might be a good area to write some JMH benchmarks around

The difference in performance is fairly minimal (though noticeable) in these test cases but I first found this issue because I refactored some $dayjob code and performance went from 15ms to 15 seconds so in worst case it can be dramatic difference

from jena.

afs avatar afs commented on July 22, 2024

This is what I get:

t is with transaction, otherwise without.

Same data text creation code.

One round of 5 each: (dataset created outside of the timing)

1: 0.677s
2: 0.463s
3: 0.372s
4: 0.442s
5: 0.335s
t1: 0.255s
t2: 0.249s
t3: 0.328s
t4: 0.302s
t5: 0.237s

reversed:

t1: 0.587s
t2: 0.331s
t3: 0.356s
t4: 0.258s
t5: 0.353s
1: 0.427s
2: 0.322s
3: 0.321s
4: 0.327s
5: 0.335s

and after a few more rounds, 5: 0.315s and t5: 0.237s. So some benefit from a transaction and no harm but specific times by contract

TIM datasets are general and robust (they provide MR+SW and are always thread safe with an "autocommit".

If the app really wants speed, use DatasetGraphFactory.create as in parse-to-dataset_02-- 5: 0.083s and t5: 0.083s. The transaction support is a lock and, being uncontended, it is cheap.

Speed up comes from class loading happening once and JIT-optimizing the parser

    public static void run(String label, Creator<DatasetGraph> maker, String text) {
        DatasetGraph dsg = maker.create();
        long millis = Timer.time(()->{
            RDFParserBuilder builder = RDFParserBuilder.create().lang(Lang.NQUADS).fromString(text);
            builder.parse(dsg);
        });
        System.out.println(label+ ": "+Timer.timeStr(millis)+"s");
    }

    public static void runTxn(String label, Creator<DatasetGraph> maker, String text) {
        DatasetGraph dsg = maker.create();
        long millis = Timer.time(()->{
            dsg.executeWrite(()->{
                RDFParserBuilder builder = RDFParserBuilder.create().lang(Lang.NQUADS).fromString(text);
                builder.parse(dsg);
            });
        });
        System.out.println(label+": "+Timer.timeStr(millis)+"s");
    }

from jena.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.