DEV Community

Victor Sanchez
Victor Sanchez

Posted on

Exploring .NET Math Libraries: An Introduction to the NMLs Research Project

Welcome to our exploration of .NET math libraries! In this blog post, we’ll dive into the NMLs (Math Libraries) research project—a solution built using .NET Core 8.0.X designed to evaluate and benchmark various math libraries.

Whether you're a developer interested in mathematical computations or a performance enthusiast, this project offers valuable insights into the capabilities and performance of different libraries.

You could find the code in this repository

Application Directory

Overview

The NMLs solution aims to provide a robust environment for exploring and benchmarking various .NET math libraries. Built on .NET Core 8.0.X, it facilitates the execution and evaluation of mathematical expressions while offering tools to compare performance across different libraries. Here’s a look at what the project entails:

Solution Structure

The Visual Studio solution for NMLs is organized into three main projects, each serving a specific purpose:

  1. MathLibsLogic
    Purpose: This project contains implementations for various math libraries.

    • Each library is encapsulated in a class named My[LibraryName], allowing for easy extension and customization.
    • Manages all NuGet package dependencies necessary for the math libraries, ensuring that all components are up-to-date and properly configured.
  2. NMLs
    Purpose: A console application that allows users to test mathematical expressions and library implementations.

    • Users can input mathematical expressions and select different library implementations to test.
    • Utilizes a loop with a property flag to keep the application running, accepting input until the user decides to exit.
  3. Benchmarking
    Purpose: To compare the performance of different math libraries.

    • Uses the BenchmarkDotNet package to provide detailed performance metrics.
    • Allows for updating and running benchmark tests with various mathematical expressions to evaluate and compare library performance.

External Projects

Our research includes evaluating the following external projects:

ExpressionEvaluator 1.4.40
A versatile library for evaluating expressions. Explore it here.

ExpresiveParser 3.0.1
A powerful parser for evaluating expressions. Check out the project here.

Microsoft.ClearScript 7.4.5
A library for integrating and executing scripts in .NET applications. Learn more here.


How to Run

Using Visual Studio

  1. Open the NMLs solution in Visual Studio.
  2. In the Solution Explorer, right-click on either the Benchmarking or NMLs project.
  3. Select "Set as Startup Project".
  4. Press F5 *or click the *"Start" button to run the project.

Using Terminal

Navigate to the root directory of the cloned repository.
Build the projects with:

dotnet build ./NMLs/NMLs.csproj
dotnet build ./Benchmarking/Benchmarking.csproj
Enter fullscreen mode Exit fullscreen mode

Run the desired project with:

dotnet run --project ./NMLs/NMLs.csproj
Enter fullscreen mode Exit fullscreen mode

Console App Running

or

dotnet build --configuration Release
dotnet run --project ./Benchmarking/Benchmarking.csproj --configuration Release
Enter fullscreen mode Exit fullscreen mode

Keep in mind that BenckmarkingDotNet needs to us the build project using Release configuration.

BenchmarkDotNet Results


Contribution

We welcome contributions to this project! If you have suggestions, improvements, or find any issues, feel free to submit issues or pull requests. Your contributions help enhance the project and benefit the community.

Top comments (0)