Add new pref maxCodeHints#9791
Conversation
There was a problem hiding this comment.
You could just do: this.maxResults = Math.min(maxResults || 1000, 1000); and remove the next 3 lines of code.
There was a problem hiding this comment.
I thought the same at first, but then thought it may confuse some.
Let's try it.
|
Issue #9529 is about a performance lag which it assumes is caused by the length of the code hints list. Did you do any measurements to see what's the difference with and without your changes? It could be that most of the time is with collecting the list (which is not addressed here) as opposed to building/displaying the list (which is addressed here). Might need to pass the |
|
I haven't done exact measuring, but it felt faster using this branch. I used a workflow similar to the one mentioned in the issue linked above. |
|
So, I've just measured the time I wonder though if we can improve |
There was a problem hiding this comment.
This maxCodeHints validation code should be moved to CodeHintList so all validation is done in 1 place.
|
Done with review. Yes, this is noticeably faster. Just 1 comment. |
|
@redmunds Ready for final review. |
|
To improve |
|
@TomMalbran We're not going to expand the focus of this pull request at this point, but I'm curious as to how you think using transforms could improve performance here. The code hint list is an absolutely positioned element so it should never cause a reflow of anything else, right? |
|
@marcelgerber I wasn't sure if the validation could would handle non-numeric cases (since the value comes from a json file), so I played around with this a bit. The good news is that all non-numeric types seems to be correctly ignored. The bad news is that floating point numbers seem to cause a problem. When I set value to Need to add some validation code to force value to be a whole number. |
|
I wast just commenting on something @marcelgerber said and I agree that it should be another PR. It is actually painting a big rectangle at the bottom-left corner of the editor, that it shouldn't. Using translate should also makes it faster to calculate. Maybe the removing the box shadow could help too. |
7a828ac to
6d9eb94
Compare
|
@redmunds Integer validation is in. |
There was a problem hiding this comment.
Need to add a @param for maxResults. I can see that it's not part of your PR, but can you also add one for insertHintOnTab too?
I'm not seeing that. Open an issue if you have a recipe for it.
I don't think @larz0 would go for that :) |
|
Looks good. Merging. |
|
@marcelgerber Can you add new pref to this doc? https://github.com/adobe/brackets/wiki/How-to-Use-Brackets#preferences |
|
@redmunds Done. @TomMalbran I did some performance measurements and AFAICT, the real bottleneck is not the rendering, but the creation. |
|
@marcelgerber I was able to remove that loop and create the jQuery objects and pass them to Mustache when rendering the list the first time. But since I still need to create the html from jQuery I am not sure if that makes it any faster. It might get faster if we could give a formatting function to the CodeHintsList and it could use it to format just the items that were required. Maybe using React here could help too, which could allow use to use virtual scrolling. |
|
@redmunds @marcelgerber Changing the position of an element trigger layout, paint and composition, while using transforms only triggers composition (http://csstriggers.com/) which is why it is faster. I heard that Chrome is trying to fix this, but until then, using transforms should be faster. |
For #9529.
I confirmed this is a performance boost for Code Hints.