You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
すごい記事が1日目2日目で来ている中で恐縮ではありますが、フロントエンドJavaScriptでパフォーマンス点から気にしたほうがいい部分について書いてみることにします。 DOM律速になるケースもある よく「JavaScriptが遅い」ということも多いのですが、具体的にはどのあたりが遅くなってくるのでしょうか. 純粋にJavaScriptのスクリプト処理が遅い…最近はブラウザ自体も高速化しては来ましたが、それを追いかけるようにJavaScriptの巨大化も進んでいます。ただし、純粋にプログラム言語的な処理なら、Web Workerに振ることで並列化が可能です。 Ajaxや画像読み込みなどの通信が遅い…サーバ側で高速化する手もありますが、状況によってはJavaScriptで先読みを始めておいて、体感時間を短くすることも可能かもしれません。 DOM操作・表示が遅い…これについて今回考えてみます。
メモがわり。 baseとなるURLを指定して相対URLを絶対URLに変換するには、ChromeやFireofxではURLUtilsを用いて以下のように書くことで簡単に実現できる。 var absolute = (new URL( "foo", "http://example.jp/bar/baz" ) ).href; // http://example.jp/bar/foo IEではURLコンストラクタはサポートされていないが、IE9以上ではDOMParserやcreateHTMLDocumentを使って現在のDOMとは分離したdocumentを生成し、その中に<base>要素を用いてbase URLを指定し、そのdocument内で<a>要素を用いて相対URLを絶対URLに変換するという手段によって相対URLを絶対URLに変換可能である。 function getAbsoluteUrl(
2015年にもなるのにJavaScriptでのDOM操作のパフォーマンスについて書く。ウェブページにインタラクションを持たせたい時に、JavaScriptでDOM操作を行うことがよくある。このDOM操作のパフォーマンスについて、よく聞く意見を大別すると次の2つがある。 JavaScriptによるDOM操作は重たい レンダリングが重いだけで、DOM操作そのものはそれほど重たくない JavaScriptでオブジェクトのプロパティを操作したりする単体の処理は通常1ミリ秒もかからないが、DOM操作をするとレンダリングが完了するまでに数十ミリ秒程度かかったりする場合がある。1番目のDOM操作が重たいと言っている人は経験則的にそう言っていることが多い。 レンダリングの仕組みを知っている人は2番目の意見を言うが、重箱の隅をつつくような話をするとこれも必ずしも正しいわけではない。DOM操作するコードによっ
Q1.について 標準化されていないと思います。 私も、7.2 The Window object - HTML Standardを見ましたが、 該当するような箇所は見つかりませんでした。 w3cの仕様でもそうですね。 Q2.について 他のイベントが発火したら書き換えられる不安定なもの、という意味では、 イベントハンドラで処理している間に他のスレッドから書き換えられる事は、 仕様上は無いので、問題なさそうです。 ブラウザにバグがあって仕様を満たしていない場合は、 どうしようもありませんが。 Javascriptでのスレッドは、メインのスレッド1つと、Web Workerのスレッドしかなく、 Web Workerからはwindowオブジェクトを参照、操作できないためです。 Javascriptがシングルスレッドという事について 仕様のどの部分によるものか、私も気になっていましたので、 この機会
I like clean code so I do what I can to avoid unwanted JavaScript global variables. I initially thought that keys(window) would give me window property leaks but that didn't work because browsers returned different results, so I moved on to using an IFRAME to compare default window property keys. When I first tried this method, I got a lame error about an IFRAME element's contentWindow property b
Many sites and apps have a lot of scripts to execute. Your JavaScript often needs to be run as soon as possible, but at the same time you don’t want it to get in the user’s way. If you send analytics data when the user is scrolling the page, or you append elements to the DOM while they happen to be tapping on the button, your web app can become unresponsive, resulting in a poor user experience. Th
This major release is focused on massive improvements in speed, URL parsing, and error handling. The potential breaking changes are highlighted in bold below; the largest ones are around the jsdom.env error-handling paradigm. This release also welcomes long-time contributer @Joris-van-der-Wel to the core team. You may recognize him from earlier changelogs. We're very happy to have his help in maki
Before we can learn Flux inside Web Workers, we need to understand DOM-Less JavaScript. Lets start with some Problems. Problem 1 : Unable to Scale JavaScript Codebase If you have written approx 50-100K lines of code at frontend then you can easily understand that “Ease of Adding a new Module/Modify Existing Module” decreases as our codebase size increases. Sometimes, We apply lots of hack or quick
Over the last few years virtual DOM implementations like React, virtual-dom, Glimmer and others have gained major adoption and changed how developers think about their interaction with the DOM. In our own work with virtual DOM implementations we have found 2 major issues that we set out to fix: We really like templates. Our designers like templates. Lets make sure we can continue to use our existi
Select DOM elements by CSS selectorquerySelectorAll - a CSS selector method like the one provided by jQuery. jQuery: $(selector), $(selector, context) Select elements by class namegetElementsByClassName - a fast way of selecting DOM elements by class name in modern browsers. Does not work in IE 8 and below. jQuery: $('.foo') Select elements by tag namegetElementsByTagName - a fast and cross browse
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く