node-mapnik
node-mapnik copied to clipboard
Avoid creating `std::string` object when not required
trafficstars
#define TOSTR(obj) (*v8::String::Utf8Value((obj)->ToString()))
Would it make sense to not always create std::string from char const*? For example
p.parse(TOSTR(info[0]);
^ this call can be expensive as info[0] represents SVG.
May we should add an extra helper macro which returns char const*
#define TO_CSTR(obj) (*v8::String::Utf8Value((obj))
Or explore using string_view like objects?
/cc @springmeyer
Nice catch. Yes, we should move to using Nan::Utf8String consistently per https://github.com/mapbox/node-cpp-skel/issues/54