dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.38k stars 9.99k forks source link

SignalR-Client-Cpp should consider using a different json library #45318

Open mprather opened 1 year ago

mprather commented 1 year ago

Summary

The alpha4 release has incorporated the use of the jsoncpp library. The team should consider switching to the nlohmann json library. The nlohmann library is a header-only library (https://github.com/nlohmann/json).

Motivation and goals

There are a few reasons why a header-only json library might fit better with signalR.

1) Less to build - every library that signalr depends upon needs to be built. this might eventually make it harder to build/deploy signalr for non-standard platforms (e.g. we went through a 9-month period where vcpkg could not be used on RPi due to a variety of issues. adding jsoncpp as a dependency simply makes that potential problem surface area even larger).

2) Less to deploy - each library dependency increases the final set of deployment files.

3) Better performance - parse time and peak memory stats for nlohmann are better than jsoncpp. The less time it takes to process json, the better. The less impact on memory, even better. Small boards with limited resources don't need to spend extra time parsing and memory allocs are super slow. Here's a handy reference that illustrates various benchmarks for common json libraries, including both jsoncpp and nlohmann, https://lokiastari.com/Json/Performance.linux.html

In scope

Changing library dependency.

Out of scope

Performance testing of libraries. It's been done by others.

Risks / unknowns

Incorporating this change should effectively backing out the compilation and deployment changes introduced with alpha4.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

adityamandaleeka commented 1 year ago

Triage: This isn't for 1.0 of the C++ client, but we could consider this in the future (especially if there's more demand).