`

GraphicsMagick性能测试(一)

 
阅读更多

安装方法:

请看《GraphicsMagick安装、实时生成缩略图

 

重要参数说明:

禁用多线程 (--disable-openmp)
编译参数:./configure --enable-shared --disable-openmp --with-quantum-depth=8 --with-windows-font-dir=/usr/share/fonts/ms_font

 

GraphicsMagick性能测试

--------------------------------------------------------------------------------------------

缩图测试:(resize、sample、thumbnail三个命令)

   -quality 80  画质80

   +profile "*" 不保存图片附加信息

 

   gm convert -resize 100x100 -quality 80 +profile "*" 原图路径  输出目录路径 

   gm convert -sample 100x100 -quality 80 +profile "*" 原图路径  输出目录路径

   gm convert -thumbnail 100x100 -quality 80 +profile "*" 原图路径  输出目录路径

 

 

缩图性能测试:

  使用gm自带的测试命令:gm benchmark -iterations 100 -rawcsv -stepthreads 1  +原命令语句

  -iterations 100  次数

  -rawcsv  打印出测试结果,是csv格式的文本 ,标题: threads,iterations,user_time秒,elapsed_time秒

  -stepthreads 1   线程增长步长,1表示每次加1个线程,一直加到OMP_NUM_THREADS环境变量的值 ,必须设置OMP_NUM_THREADS环境变量才可以真正使用起多线程(openmp)。本测试只想测试单线程就未设置 OMP_NUM_THREADS。

 

软硬件配置:

  GraphicsMagick-1.3.17

  cpu: 笔记本I5 2410 2.3G 双核4线程

  编译时使用参数--disable-openmp,禁用了多线程,所以测试时cpu占用一直是25%,我是双核4线程CPU,只用到一个逻辑核心。

 

JPG图片测试(大)

gm identify /Users/zhaorai/Desktop/5.jpg

/Users/zhaorai/Desktop/5.jpg JPEG 3648x2736+0+0 DirectClass 8-bit 2.2M 0.000u 0:01  (数码相机照的照片)

---------------------

gm benchmark -iterations 100 -rawcsv -stepthreads 1   convert -resize 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/5.jpg /Users/zhaorai/Desktop/out1.jpg 

1,100,82.62,82.850 (每秒处理1.25张,处理一张耗时820ms)

 

gm benchmark -iterations 100 -rawcsv -stepthreads 1    convert -sample 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/5.jpg /Users/zhaorai/Desktop/out2.jpg 

1,100,22.00,22.060 (每秒处理4.5张,处理一张耗时220ms)

 

gm benchmark -iterations 100 -rawcsv -stepthreads 1    convert -thumbnail 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/5.jpg /Users/zhaorai/Desktop/out3.jpg 

1,100,21.99,22.650 (每秒处理4.5张,处理一张耗时220ms)

 

JPG图片测试(小)

gm identify /Users/zhaorai/Desktop/6.jpg

/Users/zhaorai/Desktop/6.jpg JPEG 1280x800+0+0 DirectClass 8-bit 282.9K 0.000u 0:01  (屏幕抓图图片)

---------------------

gm benchmark -iterations 100 -rawcsv -stepthreads 1   convert -resize 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/6.jpg /Users/zhaorai/Desktop/6out1.jpg 

1,100,8.56,8.570 (每秒处理11.7张,处理一张耗时85ms)

 

gm benchmark -iterations 100 -rawcsv -stepthreads 1    convert -sample 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/6.jpg /Users/zhaorai/Desktop/6out2.jpg 

1,100,2.21,2.220 (每秒处理45张,处理一张耗时22ms)

 

gm benchmark -iterations 100 -rawcsv -stepthreads 1    convert -thumbnail 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/6.jpg /Users/zhaorai/Desktop/6out3.jpg 

1,100,2.48,2.480(每秒处理40.3张,处理一张耗时22ms)

 

 

PNG图片测试(小)

gm identify /Users/zhaorai/Desktop/4.png

/Users/zhaorai/Desktop/4.png PNG 1280x800+0+0 DirectClass 8-bit 246.1K 0.000u 0:01   (屏幕抓图图片)

---------------------

gm benchmark -iterations 100 -rawcsv -stepthreads 1    convert -resize 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/4.png /Users/zhaorai/Desktop/out1.png

1,100,7.52,7.540 (每秒处理 13.2张,处理一张耗时75ms)

 

gm benchmark -iterations 100 -rawcsv -stepthreads 1    convert -sample 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/4.png /Users/zhaorai/Desktop/out2.png 

1,100,3.08,3.080 (每秒处理 33.3张,处理一张耗时31ms)

 

gm benchmark -iterations 100 -rawcsv -stepthreads 1    convert -thumbnail 100x100 -quality 80 +profile "*" /Users/zhaorai/Desktop/4.png /Users/zhaorai/Desktop/out3.png 

1,100,3.41,3.410 (每秒处理 29.3张,处理一张耗时34ms)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics