Description
In my past experiments, JDTUtils.toURI
can take 20% - 80% of completion time. Below is an example of the call tree, when I press "f" for completion in spring-petclinic project. Completion list mainly include some foreach snippets and a lot of Types starting with letter F.
I'm using a relatively powerful PC, so focus more one the percentage instead of absolute millis.
The uri is filled in each completion item's data
field, and is used in completion/resove
request, to get the corresponding complilation unit. E.g.
"data": {
"decl_signature": "Lorg.springframework.boot.SpringApplication;",
"pid": "4",
"rid": "3",
"uri": "file:///C:/Users/admin/projects/spring-petclinic-main/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java"
}
When I step into it, I find most time is spent on "slashy" the uri, where it adds trailing "/" if it's a directory.
I don't think any directory would be used here in CompletionItem.data.uri
, so a simple improvement coming to my mind is to skip the slashy here, by not using java.io.File.toURI
.