サービス終了のお知らせ いつもYahoo! JAPANのサービスをご利用いただき誠にありがとうございます。 お客様がアクセスされたサービスは本日までにサービスを終了いたしました。 今後ともYahoo! JAPANのサービスをご愛顧くださいますよう、よろしくお願いいたします。
CakePHPのスピードアップTIPs。 http://www.pseudocoder.com/archives/2009/04/16/one-more-tip-for-speeding-up-cakephp-apps/ コントローラの中で、$usesでモデルをいくつも書いておけば、 $this->Model1->find(); $this->Model1->Model2->find(); みたいにして快適にモデルにアクセスできるのですが、この$usesの配列にモデル名を加えていくと、一つにつき、4-6%表示時間が多くかかるとのこと。試しに7モデルを$usesで読み込むようにしたら、40%も表示時間が増えたそうです (追記:たぶんこの比較は、あるアクションで使うモデルが1つだった場合に、$usesで7モデル定義した場合と、$usesには何も定義せず、該当アクション内で1つのモデルだけloa
JavaScriptjQuery は CSS セレクタで要素を選んで処理できるのが魅力的ですね。そんな jQuery ですが、CSS セレクタの書き方次第で速度が大幅に変わってきます。ここでは jQuery の内部処理を疑似コードで示しつつ、jQuery を高速に使うためのポイントを5つに絞って紹介します。何度も同じセレクタを実行しないクラスだけを指定するのは禁止#id を積極的に使う途中までの結果を再利用する子供セレクタ(>)を使うと速くなることがある※ この記事は jQuery 1.2.6 のソースコードを元に記述しています1. 何度も同じセレクタを実行しない改善前 // 例題 1 $("div.foo").addClass("bar"); $("div.foo").css("background", "#ffffff"); $("div.foo").click(function(){
はじめに 今回はfor文に関するtipsについて解説していきます。 for文の条件式にはcount($array)のような関数をいれない(変数に格納) for文の条件式に関数を入れると遅くなるというtipsです。 例えば配列の要素数だけfor文を用いてループを回したいときに、配列の要素数を取得できるcount()関数を使って下記のように書くことができます。 for ($j=0; $j<count($array); $j++) {} このtipsでは下記のようにあらかじめ変数に格納してからの使用を勧めてます。 $count = count($array); for ($j=0; $j<$count; $j++) {} まずはサンプルプログラムを用意し、ベンチマークをとってみます。 benchmark_for.php <?php $t = microtime(true); $i = 0; $a
に釣られて。 HatenaStar.js 1380 行目 テキストノード走査 一番のボトルネックはやはりここですね。IEなので、こんな感じでベタに計測。 makeTextNodes: function(c) { if (c.textNodes || c.textNodePositions || c.documentText) return; if (Ten.Highlight.highlighted) Ten.Highlight.highlighted.hide(); c.textNodes = []; c.textNodePositions = []; var isIE = navigator.userAgent.indexOf('MSIE') != -1; var texts = []; var pos = 0; var st = new Date*1; (function(node,
はじめに 「新はてなブックマーク」になったということで、とっても便利になったのですが、ブックマーク一覧ページ*1が若干 JavaScript に時間が掛かっているみたいです。 というわけで 調査してみたいと思います。調査して、改善できそうなところは後で纏めて「はてなアイデア」にでも登録しようと思います。 この日記は調査しながら、過程を書いていくつもりです。 準備 まずは、人のサイトの JavaScript を書き換えて試してみるための環境を作ります。 作業用ディレクトリを作る とりあえず、ホームに HatenaJS というディレクトリを作ります。 $ mkdir HatenaJS $ cd HatenaJS CocProxy をダウンロードしてくる 以下から CocProxy というツールをダウンロードしてきます。 http://coderepos.org/share/wiki/CocPr
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く