Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EmfIndex Comparison"
Line 38: | Line 38: | ||
|} | |} | ||
− | | [[Image:EmfIndex indexingTime.png]] | + | | [[Image:EmfIndex indexingTime.png|thumb]] |
|} | |} | ||
Line 105: | Line 105: | ||
|} | |} | ||
+ | <br> | ||
=== Query all references targeting a certain resource === | === Query all references targeting a certain resource === | ||
Line 150: | Line 151: | ||
|} | |} | ||
+ | <br> | ||
=== Query all instances of "EClass" === | === Query all instances of "EClass" === | ||
Line 187: | Line 189: | ||
|} | |} | ||
+ | <br> | ||
=== Navigation Query required for convenient API === | === Navigation Query required for convenient API === | ||
Line 200: | Line 203: | ||
|- | |- | ||
| eObject.getResourceDescriptor() | | eObject.getResourceDescriptor() | ||
− | | 7 µs | + | | 7 µs |
|- | |- | ||
| resource.getEObjects() | | resource.getEObjects() | ||
− | | 104 µs | + | | 104 µs |
|- | |- | ||
| resource.getReferences() | | resource.getReferences() | ||
− | | 220 µs | + | | 220 µs |
|- | |- | ||
− | | reference.getTargetObject() | + | | reference.getTargetObject() |
| 12 µs | | 12 µs | ||
|} | |} |
Revision as of 04:43, 2 September 2009
This page is intended to compare the two index implementations form different viewpoints such as
- Performance
- Memory Consumption
- How to build a convinient Query API on top of the low level API
Contents
Performance
Indexing
Indexing time
This test measured the time which is needed to index x-times the content of Ecore.ecore. (Containing 393 instances of EObject and 520 references)
|
Memory consumption
This test measured the in memory size of the index. In the SAP case, paging was disabled
|
Query response time
Query All EObject and all EReferences
|
Query all references targeting a certain resource
|
Query all instances of "EClass"
|
|
Convenient query API
The following proposal can be implemented on top of the low level API to provide a more convenient query API as proposed by Itemis. The basic idea would be to provide a specialized query factory for the convenient queries, which returns wrappers around the low level query objects. The query wrapper would also return a wrapped QueryResult object which in turn wraps the low level descriptors. The following snippet shows an example of the query factory.
public class ConvenientIndexQueryFactory { public ConvenientEObjectQuery<?> createEObjectQuery() { ... } public ConvenientEReferenceQuery<?> createEReferenceQuery() { ... } public ConvenientResourceQuery<ConvenientResourceDescriptor> createResourceQuery() { return new ConvenientResourceQueryImpl<ConvenientResourceDescriptor>(); }
The returned resource query needs to subclass our ResourceQueryImpl class and override the createQueryResult() method. This method gets an iterable with low level descriptors. The QueryResult only implements the Iterable interface and has no further methods.
public class ConvenientResourceQueryImpl<T> extends ResourceQueryImpl<T> implements ConvenientResourceQuery<T> { @Override public QueryResult<T> createQueryResult(QueryExecutorInternal queryExecutor, Iterable<ResourceDescriptor> result) { return ...; // new QueryResult implementation } }
A convenient user may use this API as like as the low level API:
public class ConvenientUser { public void test() { final ConvenientResourceQuery<ConvenientResourceDescriptor> query = new ConvenientIndexQueryFactory().createResourceQuery(); query.uri("hallo"); Index index = ...; index.executeQueryCommand(new QueryCommand() { @Override public void execute(QueryExecutor queryExecutor) { QueryResult<ConvenientResourceDescriptor> execute = queryExecutor.execute(query); } }); } }