Is there any way to make Image::read a bit faster? In my
test program
(code below) the timings come out around a half-second for
each run.
Here is the line I'm currently using to configure GM:
./configure
CFLAGS="-O3"
CXXFLAGS="-O3"
CPPFLAGS="-I/opt/local/include
-I/usr/local/include"
LDFLAGS="-L/opt/local/lib -L/usr/local/lib"
--without-perl
--disable-installed
--without-dps --without-fpx --without-jbig --without-jp2
--without-lcms --without-trio --without-ttf --without-wmf
I am on a Core 2 Duo MacBook Pro for these tests. The last
two lines of
the configure command are an effort to remove things I don't
need, but
they have not sped things up significantly. Adding -O3 to
CFLAGS and
CXXFLAGS increased speed by about 0.3 seconds.
I don't think this is a platform specific issue, as GM is
universally
slower than other solutions (I believe CoreImage on Macs and
Paintlib on
Windows). I'm committed to using GM but really need to find
a way to
speed things up. Any ideas?
Thanks,
Richard
Aaaaaaand, the code:
#include <Magick++.h>
#include <stdio.h>
#include <string>
using namespace std;
using namespace Magick;
// Fake gettimeofday on Windows
#ifdef XP_WIN
// Omitted for brevity
#else
#include <sys/time.h>
#endif
// Cheesy code timing
struct timeval first;
struct timeval last;
void start_timer() {
gettimeofday(&first, 0);
}
double stop_timer() {
gettimeofday(&last, 0);
return ((double)last.tv_sec + (double)last.tv_usec /
1000000) -
((double)first.tv_sec + (double)first.tv_usec / 1000000);
}
int main(int argc, char * * argv) {
// Must have one argument, which is a file path
if (2 == argc) {
char * path = *(argv + 1);
try {
// Time opening an image
string path_s(path);
start_timer();
Image img(path_s);
double open = stop_timer();
printf("%s: %fn", path, open);
} catch (Exception & e) {
printf("Error trying to open %s (%s).n", path,
e.what());
return 1;
}
} else {
printf("Usage: %s <image-file>n",
*argv);
return 1;
}
return 0;
}
------------------------------------------------------------
-------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and
a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Graphicsmagick-help mailing list
Graphicsmagick-help lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gra
phicsmagick-help
|