Linkify Plus Plus

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

< Spätná väzba na Linkify Plus Plus

Otázka/komentár

§
Pridaný: 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

woxxomZablokovaný
§
Pridaný: 12.11.2014
Upravený: 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
§
Pridaný: 12.11.2014
Upravený: 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
§
Pridaný: 13.11.2014

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

§
Pridaný: 22.04.2015

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

Pridať odpoveď

Aby ste mohli pridať odpoveď, prihláste sa.