Giter Site home page Giter Site logo

benchmarkdotnet-android's Introduction

BenchmarkDotNet-Android

BenchmarkDotNet projects for comparing .NET 7 to Xamarin.Android

To run the benchmarks with .NET 7 (default):

dotnet build ./DotNetRunner/DotNetRunner.csproj -c Release -t:Benchmark

To run the benchmarks with .NET 8:

dotnet build ./DotNetRunner/DotNetRunner.csproj -c Release -t:Benchmark -p:Targeting=net8.0

To run the benchmarks with "classic" Xamarin.Android:

msbuild ./XamarinRunner/XamarinRunner.csproj -restore -p:Configuration=Release -t:Benchmark

Results

An example of running all 3 benchmarks on a Pixel 5 device:

Method Mean Error StdDev Allocated
.NET 6 Random.Next 65.90 μs 0.0720 μs 0.0640 μs -
Xamarin Random.Next 84.55 μs 0.0280 μs 0.0260 μs -
.NET 6 DTO.Now 1.05 μs 0.0016 μs 0.0015 μs -
Xamarin DTO.Now 4.94 μs 0.0050 μs 0.0046 μs -
.NET 6 DTO.UtcNow 0.20 μs 0.1100 ns 0.0900 ns -
Xamarin DTO.UtcNow 0.22 μs 0.0700 ns 0.0600 ns -
.NET 6 Regex Compiled 134.70 μs 3.0500 μs 8.7600 μs 20 KB
Xamarin Regex Compiled 16.49 μs 0.1990 μs 0.1760 μs -

Note that RegexOptions.Compiled doesn't do anything in Xamarin.Android or mono/mono.

If you rerun with -p:ColdStart=true, this will simulate the cost at startup:

Method Mean Allocated
.NET 6 Random.Next 1.072 ms -
Xamarin Random.Next 1.434 ms -
.NET 6 DateTimeOffset.Now 3.367 ms -
Xamarin DateTimeOffset.Now 3.396 ms -
.NET 6 Regex Compiled 91.160 ms 22 KB
Xamarin Regex Compiled 5.132 ms -

benchmarkdotnet-android's People

Contributors

jonathanpeppers avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

igor-sidorovich

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.