Open titombo opened 10 years ago
The only thing that can cause such execution time is the script that fetches the comments count from Disqus to display them besides the paragraphs (the actual comment threads are not being pre-fetched).
You can prevent this script from running by passing displayCount: false
in your settings object. you won't be able to display the comment count though.
But already is set to '''displayCount: false''', check the code I just sent on the comment before.
Probably is one of these document.createElement. It generates this kind of script, and there is a repetition, maybe it can concatenate, here is an example of script that is gereated:
function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n,i,u){return null==n||"boolean"==typeof n?r.apply(this,arguments):this.animate(vt(t,!0),n,i,u)} function (n,i,u){return null==n||"boolean"==typeof n?r.apply(this,arguments):this.animate(vt(t,!0),n,i,u)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)} function (n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)}
It seems that create.Element is better even than an equivalent jQuery method. http://stackoverflow.com/questions/268490/jquery-document-createelement-equivalent
Is there a way to reuse the javaScript code that was already generated, without needing to generate it again ? Maybe a new parameter on the constructor.
I used your method for 3004 paragraphs in a text, check the javaScript bellow:
http://cfcomentada.azurewebsites.net/ It took 25 seconds to execute. Is there a way to make the execution quicker ? Since this page is not gonna change, maybe there is a way to store the per-proccessing somewhere.
Is this generated each time it runs the script ? http://cfcomentada.azurewebsites.net/js?v=rHWjXiMtWOTPjhUf3vKK52W1uMgkpJt0Wyh5RANE5MQ1
Thanks for the API, is helping a lot. :+1: :)