Linkify Plus Plus

Based on Linkify Plus. Turn plain text URLs into links.

< Părere la script-ul Linkify Plus Plus

Întrebare/comentariu

§
Postat în: 12-11-2014

significant increase in page load time - browser stops responding

win 7
ff 33.*
LPP 2.4.3

on quite a few sites i am seeing a very significant increase in load time while the browser stops responding - this is one example where the load time is > 20 sec. (560+ KB) ...
https://github.com/RequestPolicyContinued/requestpolicy/compare/RequestPolicy:dev-1.0...dev-1.0

woxxomMod
§
Postat în: 12-11-2014
Editat în: 12-11-2014

Seems like a bug in FF's implementation of string comparison and/or xpath. I've attached a screenshot from gecko profiler addon. BTW, I wonder if using asm.js could help by speeding up such functions as isIP, inAngular, stripSingleParenthesis... Or maybe it's faster to directly access the DOM tree and analyze text content per element...

eightAutor
§
Postat în: 12-11-2014
Editat în: 12-11-2014

Here's the xpath in version 2.4.3.

document.evaluate(".//text()[not(ancestor::a) and not(ancestor::code) and not(ancestor::head) and not(ancestor::noscript) and not(ancestor::option) and not(ancestor::script) and not(ancestor::style) and not(ancestor::title) and not(ancestor::textarea) and not(ancestor::svg) and not(ancestor::canvas) and not(ancestor::button) and not(ancestor::select) and not(ancestor::template) and not(ancestor::meter) and not(ancestor::progress) and not(ancestor::math) and not(ancestor::h1) and not(ancestor::h2) and not(ancestor::h3) and not(ancestor::h4) and not(ancestor::h5) and not(ancestor::h6) and not(ancestor::*[contains(@class, 'highlight') or contains(@class, 'editbox') or contains(@class, 'code') or contains(@class, 'brush:') or contains(@class, 'bdsug')]) and not(ancestor::*[@contenteditable='true']) and not(ancestor::*[contains(@class, 'linkifyplus')])]", document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null)

It took 6~7 seconds to execute on my notebook. I agree that filtering out the ancestors is not the best idea.

I'll try to use other methods, including traversing the DOM tree.

eightAutor
§
Postat în: 13-11-2014

Updated to version 3.0.0. The script will traverse the DOM now.

§
Postat în: 22-04-2015

missed your comment until now - i was never notified
thanks, i'll give the script another shot :)

Postează un raspuns

Autentifică-te pentru a posta un răspuns.

长期地址
遇到问题?请前往 GitHub 提 Issues。