Skip to content

Instantly share code, notes, and snippets.

View melanchall's full-sized avatar

Maxim Dobroselsky melanchall

View GitHub Profile
@melanchall
melanchall / drywetmidi-examples-createfile.cs
Last active February 24, 2021 12:22
Creating a MIDI file with the DryWetMIDI
public static void CreateMidiFile()
{
// Create an empty MIDI file
var midiFile = new MidiFile();
// Set tempo map of the file using tempo of 110 BPM. See
// https://github.com/melanchall/drywetmidi/wiki/Tempo-map to learn more about managing
// tempo map in DryWetMIDI
@melanchall
melanchall / DWM_5_2_0_Benchmarks_synth.md
Last active March 26, 2021 17:28
DryWetMIDI benchmarks (synthetic) for version 5.2.0

DryWetMIDI benchmarks (synthetic) for version 5.2.0

means improvement by 1-2 times
↓↓ means improvement by 2-5 times
↓↓↓ means improvement by >5 times

Old ms is execution time on version 5.1.2
New ms is execution time on version 5.2.0
ms ↓↑ is execution time improvement (times)
Old MB is allocated memory in megabytes on version 5.1.2

@melanchall
melanchall / DWM_5_2_0_Benchmarks_real.md
Created March 26, 2021 17:08
DryWetMIDI benchmarks (real files) for version 5.2.0

DryWetMIDI benchmarks (real files) for version 5.2.0

These benchmarks show performance improvement of methods called on MIDI files (taken from here):

  • Large (10 biggest files separately for MultiTrack and SingleTrack format)
  • Middle (10 middle-sized files separately for MultiTrack and SingleTrack format)

means improvement by 1-2 times
↓↓ means improvement by 2-5 times
↓↓↓ means improvement by >5 times

@melanchall
melanchall / medium_nuget_native_1.cs
Created October 5, 2022 16:20
[Medium] NuGet Native 1
[DllImport("test")]
public static extern int Foo();
@melanchall
melanchall / medium_nuget_native_2.cs
Created October 5, 2022 16:22
[Medium] NuGet Native 2
using System.Runtime.InteropServices;
namespace DualLibClassLibrary
{
public static class Class
{
[DllImport("test")]
public static extern int Foo();
public static int Bar()
@melanchall
melanchall / medium_nuget_native_3.cs
Created October 5, 2022 16:23
[Medium] NuGet Native 3
int Foo() { return 123; }
@melanchall
melanchall / medium_nuget_native_4.cs
Created October 5, 2022 16:24
[Medium] NuGet Native 4
int Foo() { return 456; }
@melanchall
melanchall / medium_nuget_native_5.ps1
Created October 5, 2022 16:27
[Medium] NuGet Native 5
New-Item "test.c" -ItemType File -Value "int Foo() { return 123; }"
@melanchall
melanchall / medium_nuget_native_6.cmd
Created October 5, 2022 16:28
[Medium] NuGet Native 6
gcc -v -c test.c
gcc -v -shared -o test.dll test.o
@melanchall
melanchall / medium_nuget_native_7.xml
Created October 5, 2022 16:30
[Medium] NuGet Native 7
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<LangVersion>6</LangVersion>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<PropertyGroup>
<PackageId>DualLibClassLibrary</PackageId>