[webkit-gtk] Hello, new member with some questions

Adrian Perez de Castro aperez at igalia.com
Tue Apr 17 09:32:20 PDT 2018

Hi all,

On Tue, 17 Apr 2018 10:27:48 -0500, Michael Catanzaro <mcatanzaro at igalia.com> wrote:
> On Tue, Apr 17, 2018 at 10:19 AM, Carlos Garcia Campos 
> <cgarcia at igalia.com> wrote:
> > No, there isn't. You could use any javascript utility for that.
> In practice, I've failed to find any JavaScript syntax highlighting 
> utility that can do this with acceptable performance. They all seem to 
> require huge amounts of time to present the result, whereas WebCore 
> used to be very quick. This is why Epiphany is still only capable of 
> showing  the page source in an external editor, like gedit. I think I 
> tried Rainbow and Prism, and found web sources reporting that other 
> comparable JS libraries are generally slower.
> I'm planning to just give up on syntax highlighting altogether in order 
> to bring back internal view source mode, because the user experience 
> with the external editor is very poor in flatpak.

I did a small benchmark a while ago to help figure out which JS-based
highlighter to use: https://github.com/aperezdc/js-highlighters-shootout

While they all are quite fast, CodeMirror is among the fastest but Prism
(which Michael tried) is not to fast either. For some reason running the
highlighter inside the browser turns out to be noticeably slower, but we
never got to understand the root reason why (IIRC).

Something I have been wondering is whether the initial parsing of the JS
code of the highlighter and (byte)code generation can be dominating the
case when only one run of the highlighter is done. If that's the case,
some way of having the highlighter JS code pre-compiled would alleviate
(or completely solve) the problem.

That all being said, I would rather have C/C++ code to do the job, either in
WebKit or Epiphany (yes, we could even run the syntax highlighter in the
WebExtension, or just pop up a new window/tab with a GtkSourceView inside).


 Adrián 🎩

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20180417/18f67b0b/attachment.bin>

More information about the webkit-gtk mailing list