Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:35 Go to next message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 93
Registered: December 2018
Member
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 15:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
please create an issue at github.com/eclipse/xtext-core for discussion.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Accessing Standalone Index in O(n) instead of O(1) [message #1838501 is a reply to message #1838500] Fri, 26 February 2021 15:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
btw do you have resourcedescriptiondata installed?
e.g. as org.eclipse.xtext.builder.standalone.StandaloneBuilder does?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 26 February 2021 15:47]

Report message to a moderator

Re: Accessing Standalone Index in O(n) instead of O(1) [message #1838503 is a reply to message #1838501] Fri, 26 February 2021 15:55 Go to previous message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 93
Registered: December 2018
Member
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 Apr 26 22:24:18 GMT 2024

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

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

Back to the top