Skip to content

Instantly share code, notes, and snippets.

View SupinePandora43's full-sized avatar
©️
#

SupinePandora43 SupinePandora43

©️
#
View GitHub Profile
@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
@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.
@EgorBo
EgorBo / Dynamic PGO in .NET 6.0.md
Last active January 25, 2024 15:15
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)
// 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();
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;
@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
{
@MatthewRalston
MatthewRalston / roflcopter.md
Created February 14, 2018 19:03
ROFLcopter ASCII text art

ROFLcopter ASCII

If you hear SOI SOI SOI, you better RUN RUN RUN ’cause the ROFLCOPTER ASCII army is coming for you!

THE ORIGINAL ROFLCOPTER

 ROFL:ROFL:ROFL:ROFL
         _^___
 L __/ [] \
@SaschaWillems
SaschaWillems / vk.cpp
Last active November 23, 2023 10:02
Multiple Vulkan buffer binding points
Shader
layout (location = 0) in vec3 inPos;
layout (location = 1) in vec3 inColor;
layout (location = 2) in vec3 inPosB;
layout (location = 3) in vec3 inColorB;
...
Application
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active November 16, 2024 22:55
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@MariadeAnton
MariadeAnton / hi-satellite.md
Last active August 7, 2022 18:06
Travis CI Demo Examples - GitHub Satellite 2019