node-mapnik icon indicating copy to clipboard operation
node-mapnik copied to clipboard

Avoid creating `std::string` object when not required

Open artemp opened this issue 8 years ago • 1 comments
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

artemp avatar Jul 20 '17 14:07 artemp

Nice catch. Yes, we should move to using Nan::Utf8String consistently per https://github.com/mapbox/node-cpp-skel/issues/54

springmeyer avatar Sep 09 '17 22:09 springmeyer