public class Benchmark2
{
private Base1 _b1;
private Base2 _b2;
[GlobalSetup]
public void Setup()
{
_b1 = new Sub1();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- | |
How to define a variable. | |
Just stick a new node in a property group. | |
--> | |
<PropertyGroup> | |
<!-- This node in a property group will define a variable --> | |
<TestVariable>Test Variable Value</TestVariable> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Bench | |
{ | |
private const int Rep = 10_000_000; | |
private int[] _a = new int[Rep]; | |
[GlobalSetup] | |
public void Setup() | |
{ | |
Random.Shared.GetItems([..Enumerable.Range(0, Rep)], _a); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Bench | |
{ | |
private const int Rep = 10_000_000; | |
private readonly Regex _regex = MyRegex(); | |
private readonly string _input = "723402139283478235u7uA874-sdjw4##7fshsjs6763820XSDFww+___43333hnd"; | |
private int _pos = 0; | |
[Benchmark(Baseline = true)] | |
public int Test1() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
// | |
// Copyright (c) 2018 degski | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Utils | |
{ | |
public static async ValueTask LoadCss(this IJSRuntime jsRuntime, string cssUrl) | |
{ | |
await jsRuntime.InvokeVoidAsync("eval",/*lang=javascript*/$$""" | |
import(URL.createObjectURL(new File([`import sheet from '{{cssUrl}}' assert { type: 'css' }; document.adoptedStyleSheets = [sheet];`], `./{{Guid.NewGuid()}}.js`, { type: "text/javascript" }))).then(_=>_); | |
"""); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object obj; | |
var r = 0; | |
const int cnt = 1000000; | |
var constructorInfo = typeof(Class).GetConstructor(new[] { typeof(int) })!; | |
var hCtor = constructorInfo.MethodHandle; | |
RuntimeHelpers.PrepareMethod(RuntimeMethodHandle.FromIntPtr(hCtor.Value)); | |
var pCtor = (delegate* managed<object, int, void>)hCtor.GetFunctionPointer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object obj; | |
var r = 0; | |
const int cnt = 1000000; | |
var constructorInfo = typeof(Class).GetConstructor(Array.Empty<Type>())!; | |
var hCtorDefault = constructorInfo.MethodHandle; | |
RuntimeHelpers.PrepareMethod(RuntimeMethodHandle.FromIntPtr(hCtorDefault.Value)); | |
var pCtor = (delegate*<object, void>)hCtorDefault.GetFunctionPointer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/PowerUp.Core/Decompilation/JITExtensions.cs b/src/PowerUp.Core/Decompilation/JITExtensions.cs | |
index 88b3397..0f18362 100644 | |
--- a/src/PowerUp.Core/Decompilation/JITExtensions.cs | |
+++ b/src/PowerUp.Core/Decompilation/JITExtensions.cs | |
@@ -5,23 +5,18 @@ using System.Runtime.CompilerServices; | |
using System.Text; | |
using PowerUp.Core.Console; | |
using System.Linq; | |
+using System.Runtime.InteropServices; | |
using PowerUp.Core.Decompilation.Attributes; |
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
Intel Core i7-4702MQ CPU 2.20GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.101
[Host] : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
ShortRun : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
Job=ShortRun Arguments=/p:DebugType=portable IterationCount=5
LaunchCount=1 WarmupCount=5
NewerOlder