Another string conversion performance improvement

Sep 3, 2010 at 8:26 AM

Just a suggestion.  If in JavascriptContext::SetParameter you replace

        string key;
        key = SystemInterop::ConvertFromSystemString(iName);
        (*mContext)->Global()->Set(String::New(key.c_str()), value);


        pin_ptr<const wchar_t> name_chars = PtrToStringChars(iName);
        (*mContext)->Global()->Set(String::New((uint16_t const *)(wchar_t const *)name_chars), value);

then you'll avoid:

  • Allocating a global memory handle.
  • Converting the string into ANSI.
  • Constructing a std::string and it associated memory allocation.
  • (I think) Converting the ANSI string back into a unicode string.

The same trick could easily be used wherever ConvertFromSystemString() is currently called.


Sep 8, 2010 at 8:59 PM

There's much room for a lot of optimization for managed / unmanaged inter-operations of this kind in this implementation. Your input in this regard is greatly appreciated. These optimizations will be integrated in the incoming releases.

Thanks a lot for your effort and interest.

The Noesis Team