[
https://issues.apache.org/jira/browse/JENA-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16508016#comment-16508016
]
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_r194398578
--- 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 --
I'm totally confused. The method above reads:
```
private DatasetGraphTDB getDSG() {
return ((DatasetGraphTDB)(getx().get()));
}
```
Where is `project4TupleTo3Tuple` used there?
> 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)