Performance implication of using xtextResource.getContents().get(0) [message #1817917] |
Tue, 03 December 2019 01:03  |
Eclipse User |
|
|
|
Hi All,
While profiling a piece of code, I replaced the call to
xtextResource.getContents().get(0) with xtextResource.getParseResult().getRootASTElement()
After making the change, I saw a drastic reduction in the time taken by the the method that contained in the above code.
The code `xtextResource.getContents().get(0)`, internally invokes the associated JVMModelInferrer which took most of the method execution time. My objective was to get hold of the root-object, at the same time avoid the call to the JVMModelInferrer, and the above change seems to fit the bill.
Is this a recommended thing to do? Can someone please confirm?
|
|
|
|
Re: Performance implication of using xtextResource.getContents().get(0) [message #1817927 is a reply to message #1817918] |
Tue, 03 December 2019 04:12  |
Eclipse User |
|
|
|
Hi Karsten,
Thanks for your reply.
I have a cache that holds the top-level objects of different types in multiple maps, meant for faster access. The cache gets updated/refreshed from time to time, and the update strategy is required to be fast. I believe it doesn't make sense to install the derived state at this point.
I do have other places in the code (expression execution) where the derived state gets installed.
[Updated on: Tue, 03 December 2019 04:19] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.24889 seconds