[ 
https://issues.apache.org/jira/browse/JENA-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16507497#comment-16507497
 ] 

ASF GitHub Bot commented on JENA-1562:
--------------------------------------

Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/434#discussion_r194269450
  
    --- Diff: 
jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/GraphViewSwitchable.java
 ---
    @@ -79,16 +83,34 @@ public TransactionHandler getTransactionHandler() {
         /** Return the {@code DatasetGraphSwitchable} we are viewing. */
         @Override
         public DatasetGraphSwitchable getDataset() {
    -        return getx() ;
    +        return getx();
         }
         
         /** Return the {@code Graph} from the underlying switchable.
          *  Do not hold onto this reference across switches. 
          */
         public Graph getGraph() {
    -        return getx().getGraph(getGraphName()) ;
    +        return getx().getGraph(getGraphName());
         }
     
    +    // Super uses find. Override to call GraphTDB.size()
    +    @Override
    +    protected int graphBaseSize() {
    +        if ( isDefaultGraph() )
    +            return getDSG().getDefaultGraphTDB().size();
    +        return getDSG().getGraphTDB(getGraphName()).size();
    +    }
    +
    +    private DatasetGraphTDB getDSG() {
    +        return ((DatasetGraphTDB)(getx().get()));    
    +    }
    +    
    +    private static Function<Tuple<NodeId>, Tuple<NodeId>> 
project4TupleTo3Tuple = item -> {
    --- End diff --
    
    This seems kind of out of place...


> TDB2 Graph.size() is much slower than TDB1.
> -------------------------------------------
>
>                 Key: JENA-1562
>                 URL: https://issues.apache.org/jira/browse/JENA-1562
>             Project: Apache Jena
>          Issue Type: Bug
>    Affects Versions: Jena 3.7.0
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>            Priority: Major
>             Fix For: Jena 3.8.0
>
>
> TDB2 {{Graph.size()}} is much slower than TDB1.
> TDB2 {{Graph.size()}} relies on {{GraphBase.size}}, which uses 
> {{graph.find(ANY,ANY,ANY)}} which creates nodes and triples unnecessarily for 
> the count.
> TDB1 has code to use the primary tupleindex size() operation and it 50x 
> faster on 5m triples in the default graph.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to