guardian / scribe

DEPRECATED: A rich text editor framework for the web platform
http://guardian.github.io/scribe/
Apache License 2.0
3.51k stars 245 forks source link

Micro-optimization: prevent browser relayout when placeMarkers() is called #390

Closed bradvogel closed 9 years ago

bradvogel commented 9 years ago

This is a small but meaningful optimization, as placeMarkers() is called in the performance-critical phase while the the user is typing.

Currently placeMarkers() forces a browser relayout. However, it doesn't need to since all the code that uses it strictly checks for the presence of the markers and doesn't actually read their element dimensions.

Compare devtools timeline before: before

and after: after

bradvogel commented 9 years ago

Also created https://github.com/guardian/scribe-test-harness/pull/23

hmgibson23 commented 9 years ago

Sweet :+1:

bradvogel commented 9 years ago

Looks like there's broken tests. Are those OK?

Also, are there any other places (other than https://github.com/guardian/scribe-test-harness/pull/23) that look for the markers using a regex?

hmgibson23 commented 9 years ago

Not that I can think of. I'll need to run the tests on my machine to check them properly.

On 15 June 2015 at 19:06, Brad Vogel notifications@github.com wrote:

Looks like there's broken tests. Are those OK?

Also, are there any other places (other than guardian/scribe-test-harness#23 https://github.com/guardian/scribe-test-harness/pull/23) that look for the markers using a regex?

— Reply to this email directly or view it on GitHub https://github.com/guardian/scribe/pull/390#issuecomment-112156603.


Visit theguardian.com. On your mobile and tablet, download the Guardian iPhone and Android apps theguardian.com/guardianapp and our tablet editions theguardian.com/editions. Save up to 57% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access. Visit subscribe.theguardian.com

This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way. Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.

Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP. Registered in England Number 908396

rrees commented 9 years ago

@hmgibson23 @bradvogel I think I would be happy to try and do the merge and revert if needed. The CircleCI tests (Chrome-only) are passing.

hmgibson23 commented 9 years ago

Yeah let's do the merge revert - don't see why not.