Page MenuHomePhabricator

Syntax highlighting is fast only on high-end devices
Closed, ResolvedPublic1 Estimated Story Points

Description

Currently the syntax highlighter doesn't seem to be so good. It requires a few tweaks.

Tweaks

  1. Modify the implementation of the syntax highlighter to speed the process up
  2. Prevent the syntax-highlighter from immediately firing up whenever an user stops entering something ( I guess that's how it works! ) - This seems to be preventing the user from immediately deleting the characters he types which would be frustrating (at least users who don't have high-capacity devices)

Optional

  1. Allow users to turn off syntax highlighting as it may help users of low end devices to edit articles without the syntax highlighter coming in their way
    1. In case this is implemented, users could be reported of syntax issues when trying to save articles

Event Timeline

@Kaartic Would you mind rephrasing the title of the task to specify exactly what is wrong with the syntax highlighter, instead of "tweak it"? (e.g. "syntax highlighting is slow on low-end devices")

Kaartic renamed this task from Tweak the syntax highlighter to Syntax highlighting is slow on low-end devices.May 10 2017, 3:02 PM
Kaartic renamed this task from Syntax highlighting is slow on low-end devices to Syntax highlighting is fast only on high-end devices.May 12 2017, 4:26 AM

Adding a few notes about wiki-text that I gathered.

By asking questions in the mailing list[1], I came to know of the following,

  • Wiki-text is not a regular language. This rules out the possibility of using regular expressions. (not completely, though)
  • In the context of parsing, it's not even context-free.
  • In the context of syntax highlighting it could be considered to be somewhere close to a context-free language.

Conclusions

  • As stated before it's not possible to use regular expression to identify and highlight wiki-text syntax. IOW, the current implementation, which behaves like a PDA, can't be changed as it would possibly trade-off the correctness of the output.
  • Consider running the syntax highlighter in a separate thread thus preventing it from hindering the interaction of the user. This would streamline the experience a little as it shouldn't block the main thread, anymore.

Links to mailing list threads
Wikitech-l
Mediawiki-l

Removing the wordings that say I would work on this to allow anyone interested to take this up!

It appears faster to me, but I also have a Pixel 5 so I am not the target for it. @Clovermoss would love to know if the editor for a long article has improved performance wise for you.