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

vtzero::convert_property_value inside worker #82

Closed
mapsam opened this issue Apr 16, 2018 · 3 comments
Closed

vtzero::convert_property_value inside worker #82

mapsam opened this issue Apr 16, 2018 · 3 comments
Milestone

Comments

@mapsam
Copy link
Contributor

mapsam commented Apr 16, 2018

The set_property method does some variant decoding in the main thread while constructing the final JSON object to return to node. This, in theory, could happen within the worker threads before being handled in the callback, and increase performance.

vtquery/src/vtquery.cpp

Lines 154 to 160 in 95ab347

/// used to create the final v8 (JSON) object to return to the user
void set_property(vtzero::property const& property,
v8::Local<v8::Object>& properties_obj) {
auto val = vtzero::convert_property_value<mapbox::feature::value, mapbox::vector_tile::detail::property_value_mapping>(property.value());
mapbox::util::apply_visitor(property_value_visitor{properties_obj, std::string(property.key())}, val);
}

cc @springmeyer @flippmoke

@mapsam mapsam changed the title variant inside worker vtzero::convert_property_value inside worker Apr 16, 2018
@springmeyer
Copy link
Contributor

@mapsam, this change is implemented already in #73: see the properties_vector_materialized member of the ResultObject. It is REQUIRED in the case of #73 because the actual properties are no longer in scope after returning from the threadpool (because the buffer, in the gzip case, is not alive outside the threadpool). See https://github.com/mapbox/vtquery/pull/73/files#diff-d293222b917c4d9edf75c1288538554fR378 for more details.

@mapsam
Copy link
Contributor Author

mapsam commented Apr 19, 2018

Oh awesome @springmeyer - thanks for pointing that out! 0.2.0 was just released, so perhaps we can work on this going out in 0.3.0?

@springmeyer
Copy link
Contributor

Done in #95

@springmeyer springmeyer added this to the 0.2.2 milestone Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants