Skip to content

Instantly share code, notes, and snippets.

View Trass3r's full-sized avatar

Trass3r Trass3r

View GitHub Profile
var createScene = function() {
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.ArcRotateCamera("Camera", - Math.PI / 2, Math.PI / 4, 10, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
var light1 = new BABYLON.DirectionalLight("DirectionalLight", new BABYLON.Vector3(0, -1, 1), scene);
var light2 = new BABYLON.HemisphericLight("HemiLight", new BABYLON.Vector3(0, 1, 0), scene);
light1.intensity =0.75;
light2.intensity =0.5;
@Trass3r
Trass3r / test.wpaProfile
Last active February 7, 2023 13:23
WPA profile for exporting template instantiation statistics via `wpaexporter build.etl -profile test.wpaProfile -delimiter "\t"`
<?xml version="1.0" encoding="utf-8"?>
<WpaProfileContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="2" xmlns="http://tempuri.org/SerializableElement.xsd">
<Content xsi:type="WpaProfile2">
<Sessions>
<Session Index="0">
<FileReferences />
</Session>
</Sessions>
<Views>
<View Guid="ab3305f1-304e-4545-9f85-0b7488072055" IsVisible="true" Title="Analysis">
@Trass3r
Trass3r / base.json
Created November 9, 2022 16:15
magic enum base benchmark
{
"traceEvents": [
{
"pid": 8058,
"tid": 8058,
"ph": "X",
"ts": 3546,
"dur": 108,
"name": "Source",
"args": {
This file has been truncated, but you can view the full file.
{
"traceEvents": [
{
"pid": 24148,
"tid": 24148,
"ph": "X",
"ts": 6808,
"dur": 102,
"name": "Source",
"args": {
export PATH="/c/Program Files/LLVM/bin":$PATH
find include/llvm/IR -name '*.h' | xargs clang-query -p objdir
clang-query -p objdir include\llvm\IR\Value.h include\llvm\IR\Use.h include\llvm\Analysis\CallGraph.h
clang-query -p objdir include\llvm\ADT\SmallVector.h
vs
clang-query -p objdir include\llvm\Support\Allocator.h
m cxxRecordDecl(hasDefinition().bind("d"), hasExternalFormalLinkage(), unless(anyOf(isExpansionInSystemHeader(), isExplicitTemplateSpecialization(), hasParent(classTemplateDecl()), hasParent(classTemplateSpecializationDecl()))))
Index: include/llvm/Analysis/CFGPrinter.h
===================================================================
--- include/llvm/Analysis/CFGPrinter.h (revision 177877)
+++ include/llvm/Analysis/CFGPrinter.h (working copy)
@@ -15,6 +15,7 @@
#ifndef LLVM_ANALYSIS_CFGPRINTER_H
#define LLVM_ANALYSIS_CFGPRINTER_H
+#include "llvm/PassSupport.h"
#include "llvm/Assembly/Writer.h"
#! /bin/sh
awk -- '!/^#/ {
TIMES[$4] += ($2 - $1)/1000
COUNT[$4] += 1
}
END {
for (TGT in TIMES)
AVG[TGT]=TIMES[TGT]/COUNT[TGT]
@Trass3r
Trass3r / preprocessed_code_stats.sh
Last active October 6, 2022 17:16
get statistics on preprocessed C++ code size
set -eux
cd /build/
ninja -k0
export CCACHE_DISABLE=1
# fix CMake deps: https://gitlab.kitware.com/cmake/cmake/-/issues/15555
sed -ri 's/(build .+?\.cpp\.o: .+?) \|\| \S+depends\S+/\1/g' build.ninja
# produce preprocessed sources without #line markers
objdump -M intel --disassemble='__static_initialization_and_destruction_0(int, int)' test -C -S --source-comment --visualize-jumps=on -l
static void foo() asm("myfoo") __attribute__((section("mysect")));
static void foo() {}
static void bar() {}
const void* data[] = {
(void*)&foo,
(void*)&bar
};
struct Data {
void* mine;
unsigned int theirs;