Skip to content

Instantly share code, notes, and snippets.

@badforlabor
badforlabor / simpleperf2chrome.py
Created August 6, 2025 03:56
simpleperf report数据chrome trace json格式
import re
import json
import sys
from datetime import datetime
def parse_simpleperf_line(line):
"""解析simpleperf报告中的单行数据"""
# 解析样本行
sample_pattern = re.compile(
@badforlabor
badforlabor / ReflectionHelper.cpp
Last active October 20, 2025 13:23
UnrealEngine. Set values using Property System (Reflection)
// 反射工具
class FReflectionHelper
{
public:
template <typename T>
static T GetDefault()
{
static T t;
return t;
local function test3_newindex2()
print("------- test3_newindex2 -------")
local t = {}
local _t_store = {}
local mt = {
__index = function (t, k)
print("*access to element " .. tostring(k))
@badforlabor
badforlabor / MonoTestMaterialPropertyBlock.cs
Created September 26, 2022 03:33
MaterialPropertyBlock会打断合并批次
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
[RequireComponent(typeof(SkinnedMeshRenderer))]
public class MonoTestMaterialPropertyBlock : MonoBehaviour
{
public bool UseMPB;
@badforlabor
badforlabor / boxing.cs
Created March 2, 2022 10:23
c#拆箱,装箱测试
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test_boxing
{
class Program
@badforlabor
badforlabor / 检查assetbundle的重复依赖.cs
Created December 29, 2021 06:55
检查assetbundle的重复依赖
if (GUILayout.Button("检查重复依赖"))
{
// 如果某个资源即在ab1中,又在ab2中,就是重复依赖了
var self = target as CheckDuplicatedDeps;
var abMapping = new Dictionary<string, HashSet<string>>();
System.Action<string, string> addMaping = (string a, string b) =>
{
if (!abMapping.ContainsKey(a))
@badforlabor
badforlabor / ThreadFactory.cpp
Created April 4, 2019 10:18
ThreadFactory.h
#include "ThreadFactory.h"
#if WITH_EDITOR
#include "Editor.h"
#endif
FThreadFactory* FThreadFactory::Inst = NULL;
FThreadFactory& FThreadFactory::Singleton()
{
if (Inst == NULL)