Comments on: JavaScript optimization Part 1: Adding DOM elements to document https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/ In my blog I'll try to describe about interesting technologies, my discovery in IT and some useful things about programming. Tue, 08 Sep 2015 00:13:28 +0000 hourly 1 https://wordpress.org/?v=6.7.1 By: mascon https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-235143 Sun, 31 Aug 2008 14:56:44 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-235143 array[idx++]=
еще делают так, array[array.length]=
проверенно, работает быстрее чем .push
а склеивание строк с помощью отератора += тормазит не только в JS…

]]>
By: Abadonna https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-234536 Fri, 29 Aug 2008 14:58:11 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-234536 Для IE7 метод innerHTML не прокатывает для вставки <option> в <select>. Обрезается первый открывающий тэг <option>, в результате ни один из элементов списка не отображается.

]]>
By: sunnybear https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-195764 Tue, 29 Apr 2008 04:13:12 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-195764
1
array.push

можно заменить на

1
array[idx++]=

(ага, читаем Lecompte) — будет еще быстрее :)

]]>
By: efreeti https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-132944 Fri, 21 Dec 2007 14:14:10 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-132944 BTW rest of your articles are also only connected to HTML/DOM/CSS/JS combination and not JS itself. I think it’s incorrect to name your article this way. Aren’t there quite useful topics like optimization of lookups, state pattern for avoiding if statements, etc. that really concern JS coding practices?

]]>
By: efreeti https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-132937 Fri, 21 Dec 2007 13:53:57 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-132937 I don’t quite understand what it has to do with JavaScript optimization? The only JavaScript optimization I see here is using array for string concat. The rest you were talking about is optimization of interaction with DOM ( and to tell you honestly nothing very new). Still although this method is more descriptive than using DOM methods for creation of JS, it is still ugly. In the end HTML markup should never be bundled inside the JS code, it’s already a bad practice – visualization should be separate from the logic. According to current state of things and MVC HTML is a part of the view, which is why you should not mess its creation with control (JS). So such things as HTML template should be defined outside the script. There are different ways of implementing such templating mechanism, some frameworks support such options.
You can say that you don’t have time for that and you fine with this solution. In case of small script/hack you will be right. But in any case this is far from unobtrusive JavaScript or good practise in case of larger development.

]]>
By: melco https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-86336 Tue, 14 Aug 2007 07:46:01 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-86336 [lang_ru]Ну на счет opera – самы быстрый браузер – я бы не согласился. Safari рулит, потестируй. Минимум в 2 раза быстрее всех.[/lang_ru]
[lang_en]Can’t agree about Opera is the fastest browser in the world. Try out Safary and see that it’s at least two times faster than other.[/lang_en]

]]>
By: DrGreen https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-70110 Thu, 05 Jul 2007 08:37:50 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-70110 Thanks for this article, it save my day!
Thanks again!

]]>
By: Sören https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-67980 Fri, 29 Jun 2007 05:09:03 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-67980 thanx for the article! interesting – i never thought of an array and “push” to do this. btw “push” is not compatible with ie5.0 if you care about that browser.
but one important thing – i think your ie6 install must be totally f***** up. i realy could not reproduce your measurements…
on my machine for ie6 (in test-order):
188, 125, (too long ;-), 94, 78
to get a comparison, ff1.5 takes 150ms for the first test here… so?!
to use innerHTML was also the recommendation of PPK (Peter Paul Koch), after his testings way back.
hm, there is clearly something wrong.

]]>
By: Erhan https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-49615 Tue, 22 May 2007 19:33:36 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-49615 Great article. Thank you very much.

]]>
By: Скорость работы браузеров » Блог FX’а https://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/comment-page-1/#comment-35161 Thu, 12 Apr 2007 10:10:03 +0000 http://kpumuk.info/javascript/javascript-optimization-part-1-adding-dom-elements-to-document/#comment-35161 […] После прочтения статьи Дмитрия Штефлюка про скорость работы javascript в разных браузерах я очень удивился – мой любимый Firefox оказался чуть ли не самым медленным браузером (после IE 6.0). Решил проверить самостоятельно на его тестовом примере и заодно сравнить скорость альфа-версии Firefox 3.0 с второй версией. А заодно установил Opera 9.20, которая вот вышла буквально вчера, чтобы удостовериться в ее быстроте. […]

]]>