ぼくちん: 2007年5月アーカイブ
それぞれベンチをとってみた。画像のサイズは29735 bytes。いずれもlighttpd。
ab -n 500 http://localhost:3001/image/121/view/scaled_image
ab -n 500 http://localhost:3001/static/scaled_image.jpg
ab -n 500 http://localhost:3001/files/scaled_image.jpg
上から
1, DBICで Catalyst の Chained で DBIC->find したrowから画像blobを取得してres->bodyに出力。
2, 普通ファイル
3, X-Sendfile
結果は
1, Time taken for tests: 8.706 seconds
2, Time taken for tests: 0.200 seconds
3, Time taken for tests: 5.542 seconds
おしまい。
Catalystを通すだけで、かなりコストかかる。
大量のサムネイルみたいなのにも認証が必要であれば
pop before smtpみたいに、Catalystに認証来たらそのIPからは一定時間のみ/static以下の指定ディレクトリにリクエスト許可、みたいなのがあったら速いかな。
Class::C3::XS期待。
おくればせながらインストールしてみました。
ちょこっとハマったので、メモ。Macのバージョンは10.4.9。
1、OpenCVをインスト。DarwinPortsだと現時点で0.9.9。オフィシャルから1.0をインストールしました。こちらを参考にさせていただきました。
2、cpanでinstall Image::ObjectDetect。以下のようなエラーがでて、失敗。
/usr/bin/gcc-4.0 -c -I/usr/local/include/opencv -Isrc -I/usr/local/include/opencv -O3 -DVERSION=\"0.11\" -DXS_VERSION=\"0.11\" "-I/opt/local/lib/perl5/5.8.8/darwin-2level/CORE" ObjectDetect.c In file included from ObjectDetect.xs:7: /opt/local/lib/perl5/5.8.8/darwin-2level/CORE/cv.h:14: error: redefinition of ‘struct xpvcv’ ObjectDetect.xs: In function ‘XS_Image__ObjectDetect_new’: ObjectDetect.xs:19: error: ‘CvHaarClassifierCascade’ undeclared (first use in this function) ObjectDetect.xs:19: error: (Each undeclared identifier is reported only once ObjectDetect.xs:19: error: for each function it appears in.) ObjectDetect.xs:19: error: ‘cascade’ undeclared (first use in this function) ObjectDetect.xs: In function ‘XS_Image__ObjectDetect_xs_detect’: ObjectDetect.xs:40: error: ‘CvHaarClassifierCascade’ undeclared (first use in this function) ObjectDetect.xs:40: error: ‘cascade’ undeclared (first use in this function) ObjectDetect.xs:51: error: ‘CV_BGR2GRAY’ undeclared (first use in this function) ObjectDetect.xs:55: error: parse error before ‘)’ token ObjectDetect.xs:57: error: ‘CV_HAAR_DO_CANNY_PRUNING’ undeclared (first use in this function) ObjectDetect.xs:57: warning: assignment makes pointer from integer without a cast ObjectDetect.xs: In function ‘XS_Image__ObjectDetect_DESTROY’: ObjectDetect.xs:82: error: ‘CvHaarClassifierCascade’ undeclared (first use in this function) ObjectDetect.xs:82: error: ‘cascade’ undeclared (first use in this function) ObjectDetect.xs:84: error: parse error before ‘)’ token make: *** [ObjectDetect.o] Error 1どうやら、"cv.h" が /opt/local/lib/perl5/5.8.8/darwin-2level/CORE/cv.h と /usr/local/include/opencv/cv.h、両方にあって混乱してるよう。
cpan> look Image::ObjectDetect # cp lib/Image/ObjectDetect.xs lib/Image/ObjectDetect.xs.orig # ed lib/Image/ObjectDetect.xs 2391 7 #include "cv.h" s|cv.h|../opencv/cv.h| 7 #include "../opencv/cv.h" w 2401 q # diff lib/Image/ObjectDetect.xs.orig lib/Image/ObjectDetect.xs 7c7 < #include "cv.h" --- > #include "../opencv/cv.h" # make install
3、おしまい。お知りあいではありませんが、spiritlooseさんCool!!!!!

