| Summary: | [client][editor] Investigate performance during updatePage | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Felipe Heidrich <eclipse.felipe> | ||||
| Component: | Editor | Assignee: | Project Inbox <orion.editor-inbox> | ||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | bokowski, Mike_Wilson, pwebster, Silenio_Quarti | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Felipe Heidrich
Created attachment 194196 [details]
pedro's changes
It seems that the only change in your prototype that really made any difference was the deletion of the line: clientDiv.style.width = (0x7FFFF).toString() + "px"; If we comment this line in the original updatePage() function, its time will be equivalent to the new updatePage(). This line is a work around for a problem we found on WebKit. It does not have to be done for Firefox (IE, etc). We released a change to make the line only run for WebKit. http://git.eclipse.org/c/e4/org.eclipse.orion.client.git/commit/?id=760150154880a9e56293c0caf9ddf9d8d7158201 I am not sure the other changes will improve performance. Could you confirm that this is true on your machine? > Also, the calculation of the line width and height could be improved. Once the > editor uses a fixed-size character, we could calculate the character width and > height during the editor initialization. Then the line height would always be > the same as the character height, and the line width would be > number-of-characters * character-width. This would have a considerable impact > because calling the _getLineBoundingClientRect() for each line is very > expensive. > > Finally, what is the purpose of _overlayDiv? It is only being used in Firefox > and I could not find a reason for it. Can we get rid of it? This would save > some DOM manipulation. I do not think the calculation of the line width can be done that way even for monospaced fonts. I believe it would work only for english characters. It would fail if the text had japanese characters because of font substitution. The overlayDiv is necessary to avoid the browser from changing the selection when the user clicks and drags the mouse button in the editor. We used different techniques in other browsers ("selectstart" event for Webkit, setCapture/releaseCapture for IE), but none of them worked for Firefox. > I do not think the calculation of the line width can be done that way even for
> monospaced fonts. I believe it would work only for english characters. It
> would fail if the text had japanese characters because of font substitution.
>
it would also be wrong for tab expansion, text ranges with bold, combining character, etc.
> Instead of iterating over each line using DOM methods (via "child.nextSibling" > or "_getLineNext()"), we could have an unique ID for each line and have a list > of IDs of lines to be updated. For iterating over all lines I believe child.nextSibling is faster than getElementById. It depends on the number of children, I published a little test of mine here: http://jsperf.com/getelementbyid-vs-while/2 One place where using getElementById() can probably help is: editor._getLineNode() That said, I don't think this code is hurting performance. Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see: https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see: https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html |