Skip to content

Instantly share code, notes, and snippets.

View SupinePandora43's full-sized avatar
©️
#

SupinePandora43 SupinePandora43

©️
#
View GitHub Profile
@ForeverZer0
ForeverZer0 / ExtractTarGz.cs
Last active November 7, 2024 11:06
Use pure C# to extract .tar and .tar.gz files
using System;
using System.IO;
using System.IO.Compression;
using System.Text;
namespace TarExample
{
public class Tar
{
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PhysicsMovement : MonoBehaviour
{
[SerializeField] private float _minGroundNormalY = .65f;
[SerializeField] private float _gravityModifier = 1f;
[SerializeField] private Vector2 _velocity;
// simplest file logger in c++
#include <fstream>
//#include <iostream>
static void LOG(char* message) {
//std::cout << message << std::endl;
std::fstream fs;
fs.open("log.txt", std::fstream::in | std::fstream::out | std::fstream::app);
fs << message;
fs << "\n";
fs.close();
@EgorBo
EgorBo / Dynamic PGO in .NET 6.0.md
Last active January 13, 2025 11:13
Dynamic PGO in .NET 6.0.md

Dynamic PGO in .NET 6.0

Dynamic PGO (Profile-guided optimization) is a JIT-compiler optimization technique that allows JIT to collect additional information about surroundings (aka profile) in tier0 codegen in order to rely on it later during promotion from tier0 to tier1 for hot methods to make them even more efficient.

What exactly PGO can optimize for us?

  1. Profile-driving inlining - inliner relies on PGO data and can be very aggressive for hot paths and care less about cold ones, see dotnet/runtime#52708 and dotnet/runtime#55478. A good example where it has visible effects is this StringBuilder benchmark:

  2. Guarded devirtualization - most monomorphic virtual/interface calls can be devirtualized using PGO data, e.g.:

void DisposeMe(IDisposable d)
@teo-tsirpanis
teo-tsirpanis / ScratchBuffer.cs
Created December 13, 2021 21:57
GC-friendly scratch buffers of arbitrary size in C# made easy.
// Written by Theodore Tsirpanis.
// Licensed under the CC0 license.
// SPDX-License-Identifier: CC0-1.0
using System.Buffers;
#nullable enable
/// <summary>
/// Manages temporary buffers with low GC pressure.
@joaquinicolas
joaquinicolas / gist:b7d0a0869485bca5156d0d4be87820f4
Created December 15, 2021 02:59
Setup flutter environment in arch linux
pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S flutter
java -version
sudo pacman -S jre8-openjdk