+ add benchmark for loading font faces.
This commit is contained in:
parent
a4770ac10b
commit
5703821b00
1 changed files with 39 additions and 0 deletions
|
@ -708,6 +708,41 @@ struct test12
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include <mapnik/font_engine_freetype.hpp>
|
||||||
|
|
||||||
|
struct test13
|
||||||
|
{
|
||||||
|
unsigned iter_;
|
||||||
|
unsigned threads_;
|
||||||
|
|
||||||
|
test13(unsigned iterations,
|
||||||
|
unsigned threads)
|
||||||
|
: iter_(iterations),
|
||||||
|
threads_(threads)
|
||||||
|
{
|
||||||
|
mapnik::freetype_engine::register_fonts("./fonts", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool validate()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()()
|
||||||
|
{
|
||||||
|
mapnik::freetype_engine engine;
|
||||||
|
unsigned long count = 0;
|
||||||
|
for (unsigned i=0;i<iter_;++i)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH( std::string const& name, mapnik::freetype_engine::face_names())
|
||||||
|
{
|
||||||
|
mapnik::face_ptr f = engine.create_face(name);
|
||||||
|
if (f) ++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
int main( int argc, char** argv)
|
int main( int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
|
@ -864,6 +899,10 @@ int main( int argc, char** argv)
|
||||||
benchmark(runner,"clipping polygon with mapnik::polygon_clipper");
|
benchmark(runner,"clipping polygon with mapnik::polygon_clipper");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
test13 runner(1000,10);
|
||||||
|
benchmark(runner,"create font faces");
|
||||||
|
}
|
||||||
std::cout << "...benchmark done\n";
|
std::cout << "...benchmark done\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue