ウェブページのパフォーマンスについてメモ
ネットで調べたり本読んだりして分かったこと・・・あとで書く
まず分からないところ
- document.writeを使ってlink要素をhtmlに追加して、スタイルシート読み込んだ場合。ページのコンポーネントのロードはどうなるか?
- 中断するか、妨げないか。IEとFxで違いはあるか。ソース
- IEでのみサポートされてるscript要素のdefer属性。これを他のブラウザ(まずはFx)でjavascriptで実装できるか
- ちょっと調べてみて分からなかった
- IE限定。defer属性があるときとないときで、ページのコンポーネントのロード・レンダリングに違いはあるか。
- 『High Performance Web Sites』p50によると、defer付きだとscript要素のロードはページのレンダリングを妨げないと書かれてる。ieHTTPHeadersでヘッダを素人の自分がみた限りだと、defer付きscript要素のロードは他のコンポートネントのロードをブロックしてない気がする。他のコンポーネントと並列してロードされる?deferつきscript要素のロード(というよりそこからリンクされてるjsファイルのロード)は、最大接続数の数にカウントされてる?
- http1.1の仕様で定めている最大接続数(1ホスト2ファイル)について。link要素とscript要素はコンポーネントにカウントされるか
- してない・・・気がする。script要素は1ファイルずつロードしてる気がする(コードの依存関係があるから登場した順番にロードしてるのでは?)・・
以下はdeferつきscript要素の読み込みのテストページ(Deferred Scripts)のieHTTPHeadersのログ
GET /bin/sleep.cgi?type=gif&sleep=2&expires=-1&last=0&imagenum=1&t=1226049121 HTTP/1.1
Accept: */*
Referer: http://stevesouders.com/hpws/js-defer.php?t=1226049115625
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: stevesouders.com
Connection: Keep-Alive
Cookie: RT=s=1226049228515&r=http%3A//stevesouders.com/hpws/js-defer.php%3Ft%3D1226049115625HTTP/1.1 200 OK
Date: Fri, 07 Nov 2008 09:13:50 GMT
Server: Apache/2.0.61 (Unix) PHP/4.4.7 mod_ssl/2.0.61 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
Expires: Wed, 08 Oct 2008 09:13:52 GMT
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: image/gifGET /bin/sleep.cgi?type=gif&sleep=2&expires=-1&last=0&imagenum=2&t=1226049121 HTTP/1.1
Accept: */*
Referer: http://stevesouders.com/hpws/js-defer.php?t=1226049115625
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: stevesouders.com
Connection: Keep-Alive
Cookie: RT=s=1226049228515&r=http%3A//stevesouders.com/hpws/js-defer.php%3Ft%3D1226049115625HTTP/1.1 200 OK
Date: Fri, 07 Nov 2008 09:13:52 GMT
Server: Apache/2.0.61 (Unix) PHP/4.4.7 mod_ssl/2.0.61 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
Expires: Wed, 08 Oct 2008 09:13:54 GMT
Content-Length: 1525
Keep-Alive: timeout=2, max=99
Connection: Keep-Alive
Content-Type: image/gifGET /bin/sleep.cgi?type=gif&sleep=2&expires=-1&last=0&imagenum=3&t=1226049121 HTTP/1.1
Accept: */*
Referer: http://stevesouders.com/hpws/js-defer.php?t=1226049115625
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: stevesouders.com
Connection: Keep-Alive
Cookie: RT=s=1226049228515&r=http%3A//stevesouders.com/hpws/js-defer.php%3Ft%3D1226049115625HTTP/1.1 200 OK
Date: Fri, 07 Nov 2008 09:13:54 GMT
Server: Apache/2.0.61 (Unix) PHP/4.4.7 mod_ssl/2.0.61 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
Expires: Wed, 08 Oct 2008 09:13:56 GMT
Keep-Alive: timeout=2, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: image/gifGET /bin/sleep.cgi?type=gif&sleep=2&expires=-1&last=0&imagenum=4&t=1226049121 HTTP/1.1
Accept: */*
Referer: http://stevesouders.com/hpws/js-defer.php?t=1226049115625
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: stevesouders.com
Connection: Keep-Alive
Cookie: RT=s=1226049228515&r=http%3A//stevesouders.com/hpws/js-defer.php%3Ft%3D1226049115625HTTP/1.1 200 OK
Date: Fri, 07 Nov 2008 09:13:57 GMT
Server: Apache/2.0.61 (Unix) PHP/4.4.7 mod_ssl/2.0.61 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
Expires: Wed, 08 Oct 2008 09:13:59 GMT
Keep-Alive: timeout=2, max=97
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: image/gifGET /bin/sleep.cgi?type=js&sleep=10&expires=-1&last=0 HTTP/1.1
Accept: */*
Referer: http://stevesouders.com/hpws/js-defer.php?t=1226049115625
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: stevesouders.com
Connection: Keep-Alive
Cookie: RT=s=1226049228515&r=http%3A//stevesouders.com/hpws/js-defer.php%3Ft%3D1226049115625HTTP/1.1 200 OK
Date: Fri, 07 Nov 2008 09:13:50 GMT
Server: Apache/2.0.61 (Unix) PHP/4.4.7 mod_ssl/2.0.61 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
Expires: Wed, 08 Oct 2008 09:14:00 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 188
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: application/x-javascript