Skip to content

Instantly share code, notes, and snippets.

Andrew zezba9000

Block or report user

Report or block zezba9000

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CS_NoStackCpy.md

Removing C# stack copies syntactically

A proposal that eliminates stack copies at the heart of C type'ish languages like C# when using 'structs' (aka value types) heavily as is done in image manipulation, graphics in general, physics, games, Unity3D, etc (I'm sure there are many more fields as well).

Key arguments for this feature

  • 40% .NET Core & Framework performance increase on i3-7100 using this benchmark with 'USE_OUT' enabled: Link
    • Performance increase could actually be higher if the code complexity increased.
    • Not yet tested but guessing even a bigger gain on ARM SoC.
  • Allows one to describe vector based algorithms in C# as you do in HLSL, GLSL, CG, etc without performance loss due to stack copies.
  • You can maintain operator 'precedence' in vector math as is done with primitive types in C#.
  • Doesn't break older C# or .NET runtime versions.
@zezba9000
zezba9000 / LightMapSwitcher.cs
Last active Jul 31, 2018
Unity LightMapSwitcher
View LightMapSwitcher.cs
using UnityEngine;
using System;
using System.IO;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif
[Serializable]
View SimpleHTTPServer.cs
// Modified from: https://gist.github.com/aksakalli/9191056
using System;
using System.Collections.Generic;
using System.Net;
using System.IO;
using System.Threading;
namespace MyNamespace
{
@zezba9000
zezba9000 / HTTPServer.cs
Last active May 8, 2019
HTTP C# server
View HTTPServer.cs
// Modified from: https://gist.github.com/aksakalli/9191056
using System;
using System.Collections.Generic;
using System.Net;
using System.IO;
using System.Threading;
namespace MyNamespace
{
@zezba9000
zezba9000 / .cs
Created Mar 26, 2017
C# Threaded Jobs
View .cs
using System;
using System.Threading;
namespace ThreadJobs
{
abstract class Job : IDisposable
{
private Thread thread;
private volatile bool waiting;
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/hwapp.dll",
"args": [],
@zezba9000
zezba9000 / VTableMethodHooking.cpp
Last active Oct 11, 2018
VTable Method hooking
View VTableMethodHooking.cpp
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
#include <string>
using namespace std;
class Base
{
public:
virtual void foo(int i)
View Sandbox Lang
`INFO =======================================================`
`File Ext = '.rl'`
`NOTE: This lang compiles out to other lang targets such as C, Nim, C#, Java, javaScript, etc`
`The lang utalizes the native GC in each target. If a GC doesn't exist a simple one capabled of running on Arduino to PC will be implemented`
`This lang is strong typed, supports runtime type info and objects/classes are linked via namespace over file location (like C#)`
`There are two primary goals with this lang
#1 portability (Arduino'ish devices with 1kb or less of ram to PCs with GBs of ram) [Almost any CPU should work out of the box with code gen targets]
#2 performance (targets like Nim [deterministic GC] and C will get you this)`
You can’t perform that action at this time.