Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Accessing Standalone Index in O(n) instead of O(1)
Accessing Standalone Index in O(n) instead of O(1) [message #1838499] Fri, 26 February 2021 10:35 Go to next message
Eclipse UserFriend
Hi,

I was under the impression that searching an item in the index (meaning an IResourceDescriptions instance) would be in O(1), if the fully qualified name is given. Under Eclipse, this seems to work fine.

However under Standalone, the access seems to be in O(n) (where n is the number of resources within the resourceSet). Am I doing something wrong or is this working as intended?

More details:
1. as index the class
ResourceSetBasedResourceDescriptions 
is used.
2. the access is in O(n), because
ResourceSetBasedResourceDescriptions.getExportedObjects(EClass, QualifiedName, boolean)
indirectly calls
ResourceSetBasedResourceDescriptions.getSelectables()
which then calls
ResourceSetBasedResourceDescriptions.getAllResourceDescriptions()
which iterates over all resources in order to create ResourceDescriptions. Details are listed below.
3. I call the index by making use of containers, in order to deal with classpath issues:

	private def getVisibleEObjectDescriptionsByName(Resource r, EClass type, QualifiedName fqn) {
		val tmp = r.getVisibleContainers.flatMap [ c |
			c.getExportedObjects(type, fqn, false)
		]
		return tmp
	}



Listings for Point 2:
	@Override
	public Iterable<IEObjectDescription> getExportedObjects(EClass type, QualifiedName qualifiedName, boolean ignoreCase) {
		if (data != null) {
			return data.getExportedObjects(type, qualifiedName, ignoreCase);
		}
		return super.getExportedObjects(type, qualifiedName, ignoreCase);
	}


	@Override
	protected Iterable<? extends ISelectable> getSelectables() {
		return getAllResourceDescriptions();
	}



Re: Accessing Standalone Index in O(n) instead of O(1) [message #1838500 is a reply to message #1838499] Fri, 26 February 2021 10:39 Go to previous messageGo to next message
Eclipse UserFriend
please create an issue at github.com/eclipse/xtext-core for discussion.
Re: Accessing Standalone Index in O(n) instead of O(1) [message #1838501 is a reply to message #1838500] Fri, 26 February 2021 10:45 Go to previous messageGo to next message
Eclipse UserFriend
btw do you have resourcedescriptiondata installed?
e.g. as org.eclipse.xtext.builder.standalone.StandaloneBuilder does?

[Updated on: Fri, 26 February 2021 10:47] by Moderator

Re: Accessing Standalone Index in O(n) instead of O(1) [message #1838503 is a reply to message #1838501] Fri, 26 February 2021 10:55 Go to previous message
Eclipse UserFriend
I created the topic here: https://github.com/eclipse/xtext-core/issues/1683

Quote:

btw do you have resourcedescriptiondata installed?
e.g. as org.eclipse.xtext.builder.standalone.StandaloneBuilder does?

I don't think so, as I don't know what that is. I guess the serialization of the index? The data-property was null while debugging, so I don't think so.
I did not even reference to the builder-plugin. I will look into the StandaloneBuilder.

FYI: I am on XText 2.16, so things might have changed already.
Previous Topic:Enhancing warnings from validator with resolve actions
Next Topic:Concrete to abstract syntax
Goto Forum:
  


Current Time: Fri Jul 04 12:18:27 EDT 2025

Powered by FUDForum. Page generated in 0.10810 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top