afs commented on issue #2400:
URL: https://github.com/apache/jena/issues/2400#issuecomment-2045361221

   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
   
   ```java
       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");
       }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to