Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use expression_factory::parse_from_string not parse_expression in text formatting load_xml #1168

Closed
springmeyer opened this issue Apr 6, 2012 · 5 comments
Labels
Milestone

Comments

@springmeyer
Copy link
Member

No description provided.

@springmeyer
Copy link
Member Author

@herm - was this in your plans? Were re-using the grammars in the fast_cast stuff but it appears we're not yet re-using grammers in the text formatting/placement from_xml parsing. Am I seeing that right?

@springmeyer
Copy link
Member Author

this looks like the performance culprit: https://github.com/mapnik/mapnik/blob/master/src/formatting/text.cpp#L50

@artemp
Copy link
Member

artemp commented Jul 3, 2012

@herm did you have a chance to look into this ?

@springmeyer
Copy link
Member Author

It looks to me that being able to pass the grammar through is going to require some serious cleanup and refactoring of the new text formatting/placement stuff. @herm - can you comment on how you see this working?

@artemp
Copy link
Member

artemp commented Jul 4, 2012

@herm @springmeyer

this line :

return boost::make_shared<text_node>(parse_expression(data, "utf8"));

expands to :

transcoder tr("utf8");
mapnik::expression_grammar<std::string::const_iterator> grammar(tr);
expression_ptr expr(boost::make_shared<expr_node>(false));
expression_factory::parse_from_string(expr, data, grammar);
return boost::make_shared<text_node>(expr);

which is expensive.

herm added a commit that referenced this issue Jul 4, 2012
@herm herm closed this as completed in 82d7a63 Jul 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants