Whats faster: returning JSON from C++ as String or as JSON objects RRS feed

  • General discussion

  • I have like 25000 records I want to give back to the calling JS from my WinRT component.

    Currently I use a Map to transform the records. This is slow.

    auto row = ref new Platform::Collections::Map<Platform::String^, Platform::Object^>();
        int columnCount = ColumnCount();
        for (int i = 0 ; i < columnCount; ++i) {
          auto name = ColumnName(i);
          row->Insert(name, GetColumn(i));
        return row->GetView();

    Now I wonder if it would be faster to construct the JSON objects using the WinRT Json API or just hand over a string containing the JSON and let Chakra do the parsing on the JS side. Using Json WinRT objects would still yield a call back to C++ realm when they are accessed from the JS side, wouldn't it?

    • Changed type Dino He Monday, July 16, 2012 9:46 AM
    Friday, July 13, 2012 5:24 PM

All replies

  • Update: Returning a Platform::String^ of JSON is actually ~10 times fasters. Go figure.
    Monday, July 16, 2012 8:31 AM