Skip to content

Instantly share code, notes, and snippets.

View BrennanConroy's full-sized avatar

Brennan BrennanConroy

View GitHub Profile
Sampling process 91708 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling dotnet (pid 91708) every 1 millisecond
Process: dotnet [91708]
Path: /Users/asplab/.dotnet/dotnet
Load Address: 0x1007c3000
Identifier: dotnet
Version: 0
Code Type: X86-64
Parent Process: dotnet [91706]
{
"Logging": {
"Default": {
"LogLevel": {
"Microsoft.AspNetCore": "Critical",
"System": "Warning"
}
},
"DebugLogger": { // do these override "Default" section above?
"LogLevel": {
var nagle = new NagleTimer();
while (true)
{
var result = await reader.ReadAsync();
var buffer = result.Buffer;
try
{
if (!buffer.IsEmpty)
class transport
{
void start(std::string url, transfer_format format, std::function<void(std::exception_ptr)> callback);
void stop(std::function<void(std::exception_ptr)> callback);
void on_close(std::function<void(std::exception_ptr)>);
void send(std::string payload, std::function<void(std::exception_ptr)> callback);
void on_receive(std::function<void(std::string, std::exception_ptr)> callback);
@BrennanConroy
BrennanConroy / allocations.md
Last active May 28, 2019 06:37
Hidden allocations of .NET

Intro: always measure first and test after

Start simple:

  • class vs. struct

  • pre-alloc container sizes if possible

  • string.Substring(1, 10);

  • stackalloc byte[]/Span

  • for loops vs. foreach loops

using System;
using System.Collections.Generic;
using System.Net.WebSockets;
using System.Threading.Tasks;
namespace ConsoleApp
{
internal class Program
{
public static async Task Main(string[] args)