Giter Site home page Giter Site logo

lauromoura / csharp-native-benchmarks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from expertisesolutions/csharp-native-benchmarks

0.0 2.0 0.0 50 KB

Some simple benchmarks to check C#'s interoperability with native code.

License: Boost Software License 1.0

C# 3.55% Jupyter Notebook 95.79% Makefile 0.26% Python 0.39%

csharp-native-benchmarks's Introduction

Simple C# DllImport benchmarks

This is a set of simple benchmarks to estimate a baseline of the cost of common scenarions when C# works with native code through DllImport & friends.

The test code runs a large number of operations and averages out over the number of operations, as the resolution of Stopwatch is not small enough.

Requirements

  • Mono >= 5.0
  • Dotnet >= 3.0, with both netcoreapp3.0 and netcoreapp2.2 frameworks.
  • python with pandas and seaborn for plotting the graphics

Usage

$ make
$ make plot

Results

These plots discard the initial iterations as they happen to be quite slow due to the initial JIT'ing of the managed code. The x axis shows the number of iterations and the y axis shows the average time per iteration in microseconds.

  • ManagedStatic - Simple call to an empty static method.

ManagedStatic results

  • ManagedVirtual - Simple call to a virtual instance method

ManagedVirtual results

  • DllImportDirect - Call to fprintf redirect to /dev/null

DllImportDirect results

  • DllImportCustomMarshaller - Call to fprintf but using an empty ICustomMarshaler for the string being passed.

DllImportCustomMarshaller results

  • DllImportWithCallback - Call to native qsort passing a C# callback.

DllImportWithCallback results

System

  • Dell XPS 15 9560
  • i7-7700HQ @ 2.8 GHz
  • 32 GB RAM
  • Ubuntu 19.10
  • Mono JIT/mcs 6.4.0.198 from Mono's repo.
  • dotnet 3.0.100 from Microsoft's repo, targeting netcoreapp both 2.2 and 3.0

csharp-native-benchmarks's People

Contributors

lauromoura avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.