Open GoogleCodeExporter opened 9 years ago
Running the basic test suite page (for actual Flash insertion) :
http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_dynamic.html
I am not seeing the same results as you. I get a 58ms DOMContentLoaded call.
This is using a 2.4Ghz PC (Chrome 10.0.642 speedTracer)
As SWFObject 2.x is designed to be placed in the <head>, rather inline so that
it can execute its calls at the correct time, can you please test with one of
the test suite pages like the above and see what affect that has on your
results?
Original comment by aran.rhee@gmail.com
on 22 Jan 2011 at 2:35
Attachments:
Page: http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_dynamic.html
Results: 1088ms, 615ms, 625ms, 597ms, 615ms
(I've attached an archive of the screenshots.)
I understand that it was designed to be placed on the head. The feature is for
people who've decided to follow the best practices
(http://developer.yahoo.com/performance/rules.html#js_bottom). I believe they
shouldn't have to be taxed for the dom-ready check (whether that is 300ms or
50ms), since it's not needed for them.
Original comment by GeorgeC...@gmail.com
on 22 Jan 2011 at 4:36
Attachments:
Ran another set of tests on a different, more powerful machine (Quad core
2.66Ghz, 4GB, Ubuntu 10.10, Chrome 10.0.642.2 dev). The results are a bit
better:
test_dynamic.html (from bobbyvandersluis.com)
[in ms]
1. 120
2. 130
3. 126
4. 130
5. 127
[screenshots attached in the archive]
empty_page (from the HTML above) [swfobject isn't called, just included]
[in ms]
1. 111
2. 106
3. 111
4. 108
5. 106
So, once again, by including swfobject on the page, I'll get hit with a
"Sluggishness (events)" spike, and on this (more powerful hardware) will add
~100ms to the page load-time.
Original comment by GeorgeC...@gmail.com
on 25 Jan 2011 at 9:44
Attachments:
If you are planning to take the diff above, here's the revised, working version:
//---------------
if (isInitDelayed) {
var that = this,
isInitialized = false;
for (var fn in publicApi) {
(function(oldFn) {
if (typeof oldFn === "function") {
publicApi[fn] = function() {
if (!isInitialized) {
main();
isInitialized = true;
}
return oldFn.apply(that, arguments);
};
}
}(publicApi[fn]));
}
}
//---------------
Original comment by GeorgeC...@gmail.com
on 31 Jan 2011 at 7:21
This is certainly something worth considering, but I'm not sure if it will make
the cut for the next update, as we're trying to focus on squashing bugs, not
adding new features.
Thanks for the detailed information and code
Original comment by platelu...@gmail.com
on 16 May 2011 at 5:05
Placing on hold as our next release focuses on bug fixes.
Original comment by platelu...@gmail.com
on 18 May 2011 at 8:25
I technically have a separate problem, but that can be solved the same way that
this problem can be solved: by simply exposing the "callDomLoadFunctions"
method by including it on the global "swfobject" variable.
My problem is encountered when using RequireJS to include the swfobject
library. If any JSONP calls are made and left hanging (for say 20 seconds),
then the "onDomLoad" function (from "swfobject.js") prevents the execution of
"callDomLoadFunctions" until those pending JSONP calls return a response or
timeout.
My application relies on jQuery to first detect the dom ready event before
executing code that involves swfobject. Because of this, I (just like
GeorgeC...@gmail.com) need the ability to forego the swfobject library's delay
in executing its functionality that waits for the dom ready event.
I've added the one line of code necessary to fix this in the attached file.
Additionally, I understand the desire to only introduce bug fixes in the next
version, but this fix cannot potentially introduce new bugs, thus the stability
for the next version is not in jeopardy if you so choose to include this.
Original comment by sakat...@gmail.com
on 20 Oct 2014 at 7:09
Attachments:
Original issue reported on code.google.com by
GeorgeC...@gmail.com
on 21 Jan 2011 at 10:56Attachments: