Merge commit '1356775299bfd5806b76a4a8067b93fba03c7dca' into harfbuzz
This commit is contained in:
commit
ff3c3ad97d
4 changed files with 127 additions and 73 deletions
|
@ -1496,7 +1496,7 @@ if not preconfigured:
|
|||
|
||||
# Common C++ flags.
|
||||
if env['THREADING'] == 'multi':
|
||||
common_cxx_flags = '-D%s -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE ' % env['PLATFORM'].upper()
|
||||
common_cxx_flags = '-D%s -DMAPNIK_THREADSAFE ' % env['PLATFORM'].upper()
|
||||
else :
|
||||
common_cxx_flags = '-D%s ' % env['PLATFORM'].upper()
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ typedef clock_type::duration dur;
|
|||
template <typename T>
|
||||
void benchmark(T test, std::string const& name)
|
||||
{
|
||||
try {
|
||||
bool should_run_test = true;
|
||||
if (!test_set.empty()) {
|
||||
should_run_test = test_set.find(test_num) != test_set.end();
|
||||
|
@ -70,6 +71,9 @@ void benchmark(T test, std::string const& name)
|
|||
<< boost::chrono::duration_cast<milliseconds>(elapsed) << "\n";
|
||||
}
|
||||
}
|
||||
} catch (std::exception const& ex) {
|
||||
std::clog << "test runner did not complete: " << ex.what() << "\n";
|
||||
}
|
||||
test_num++;
|
||||
}
|
||||
|
||||
|
@ -313,7 +317,7 @@ struct test6
|
|||
void operator()()
|
||||
{
|
||||
unsigned count=0;
|
||||
for (int i=-180;i<180;i=++i)
|
||||
for (int i=-180;i<180;++i)
|
||||
{
|
||||
for (int j=-85;j<85;++j)
|
||||
{
|
||||
|
@ -328,6 +332,65 @@ struct test6
|
|||
}
|
||||
};
|
||||
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/expression.hpp>
|
||||
#include <mapnik/expression_string.hpp>
|
||||
|
||||
struct test7
|
||||
{
|
||||
unsigned iter_;
|
||||
unsigned threads_;
|
||||
std::string expr_;
|
||||
explicit test7(unsigned iterations,
|
||||
unsigned threads,
|
||||
std::string const& expr) :
|
||||
iter_(iterations),
|
||||
threads_(threads),
|
||||
expr_(expr)
|
||||
{}
|
||||
|
||||
bool validate()
|
||||
{
|
||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,"utf-8");
|
||||
return mapnik::to_expression_string(*expr) == expr_;
|
||||
}
|
||||
void operator()()
|
||||
{
|
||||
for (int i=0;i<iter_;++i) {
|
||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,"utf-8");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#include <mapnik/expression_grammar.hpp>
|
||||
|
||||
struct test8
|
||||
{
|
||||
unsigned iter_;
|
||||
unsigned threads_;
|
||||
std::string expr_;
|
||||
explicit test8(unsigned iterations,
|
||||
unsigned threads,
|
||||
std::string const& expr) :
|
||||
iter_(iterations),
|
||||
threads_(threads),
|
||||
expr_(expr)
|
||||
{}
|
||||
|
||||
bool validate()
|
||||
{
|
||||
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(transcoder("utf-8"));
|
||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar);
|
||||
return mapnik::to_expression_string(*expr) == expr_;
|
||||
}
|
||||
void operator()()
|
||||
{
|
||||
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(transcoder("utf-8"));
|
||||
for (int i=0;i<iter_;++i) {
|
||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main( int argc, char** argv)
|
||||
{
|
||||
|
@ -402,27 +465,11 @@ int main( int argc, char** argv)
|
|||
mapnik::box2d<double> to(-20037508.3427892476,-15538711.0963092316,20037508.3427892476,15538711.0963092316);
|
||||
|
||||
{
|
||||
test6 runner(1,5,
|
||||
"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
|
||||
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
from,to,false);
|
||||
benchmark(runner,"lonlat -> merc coord transformation with proj4 init (literal)");
|
||||
}
|
||||
|
||||
{
|
||||
test6 runner(1,5,
|
||||
"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
|
||||
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
from,to,true);
|
||||
benchmark(runner,"lonlat -> merc coord transformation with lazy proj4 init (literal)");
|
||||
}
|
||||
|
||||
/*{
|
||||
// echo -180 -60 | cs2cs -f "%.10f" +init=epsg:4326 +to +init=epsg:3857
|
||||
test6 runner(100000000,100,
|
||||
"+init=epsg:4326",
|
||||
"+init=epsg:3857",
|
||||
from,to,false);
|
||||
from,to,true);
|
||||
benchmark(runner,"lonlat -> merc coord transformation (epsg)");
|
||||
}
|
||||
|
||||
|
@ -430,17 +477,35 @@ int main( int argc, char** argv)
|
|||
test6 runner(100000000,100,
|
||||
"+init=epsg:3857",
|
||||
"+init=epsg:4326",
|
||||
to,from,false);
|
||||
to,from,true);
|
||||
benchmark(runner,"merc -> lonlat coord transformation (epsg)");
|
||||
}*/
|
||||
}
|
||||
|
||||
/*{
|
||||
test6 runner(10,2,
|
||||
{
|
||||
test6 runner(100000000,100,
|
||||
"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
|
||||
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
from,to,true);
|
||||
benchmark(runner,"lonlat -> merc coord transformation (literal)");
|
||||
}
|
||||
|
||||
{
|
||||
test6 runner(100000000,100,
|
||||
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
|
||||
to,from,false);
|
||||
to,from,true);
|
||||
benchmark(runner,"merc -> lonlat coord transformation (literal)");
|
||||
}*/
|
||||
}
|
||||
|
||||
{
|
||||
test7 runner(10000,100,"([foo]=1)");
|
||||
benchmark(runner,"expression parsing with grammer per parse");
|
||||
}
|
||||
|
||||
{
|
||||
test8 runner(10000,100,"([foo]=1)");
|
||||
benchmark(runner,"expression parsing by re-using grammar");
|
||||
}
|
||||
|
||||
std::cout << "...benchmark done\n";
|
||||
return 0;
|
||||
|
|
|
@ -348,7 +348,7 @@ void save_to_stream(T const& image,
|
|||
}
|
||||
else if (boost::algorithm::starts_with(t, "tif"))
|
||||
{
|
||||
#if defined(HAVE_JPEG)
|
||||
#if defined(HAVE_TIFF)
|
||||
save_as_tiff(stream, image);
|
||||
#else
|
||||
throw ImageWriterException("tiff output is not enabled in your build of Mapnik");
|
||||
|
|
|
@ -113,16 +113,11 @@ bool proj_transform::forward (double * x, double * y , double * z, int point_cou
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480
|
||||
mutex::scoped_lock lock(projection::mutex_);
|
||||
#endif
|
||||
if (pj_transform( source_.proj_, dest_.proj_, point_count,
|
||||
0, x,y,z) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dest_longlat_)
|
||||
{
|
||||
|
@ -160,17 +155,11 @@ bool proj_transform::backward (double * x, double * y , double * z, int point_co
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480
|
||||
mutex::scoped_lock lock(projection::mutex_);
|
||||
#endif
|
||||
|
||||
if (pj_transform( dest_.proj_, source_.proj_, point_count,
|
||||
0, x,y,z) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_source_longlat_)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue