Skip to content

Instantly share code, notes, and snippets.

View mohsen1's full-sized avatar
🎯
Focusing on tsz

Mohsen Azimi mohsen1

🎯
Focusing on tsz
View GitHub Profile
@mohsen1
mohsen1 / perf-expert-question.md
Created April 28, 2026 05:38
tsz performance: closing a 200x+ gap to tsgo on large-ts-repo — observations and questions for an experienced compiler perf expert

tsz perf: how do we close a 200x+ gap to tsgo on large-ts-repo?

Background

tsz is a Rust port of the TypeScript compiler, aiming for parity with tsc behavior plus better speed than tsgo (the Go port). On most fixtures we're competitive or ahead, but on multi-package monorepo workloads we are catastrophically behind:

Fixture Files tsgo tsz Factor
utility-types small 117ms 100ms tsz 1.17× faster
type-fest (heavy .d.ts mapped types) 16.5K LOC 103ms 219ms tsgo 2.11× faster
@mohsen1
mohsen1 / README.md
Last active May 11, 2025 23:33
A quick node.js script to run yek to serialize the repo + test failures to ask Deepseek for help

ask.js

CLI tool that uses DeepSeek AI to debug Rust projects by analyzing test failures.

This is highly personalized to my own use case. But you can customize it for yourself.

This will collect all of test failues, filter out passing test, serialize the repo and git changes into one request to ask deepseek for help

Setup

@mohsen1
mohsen1 / README.md
Last active December 25, 2024 08:05
Serialize repo for LLMs

serialize-repo.ts

You probably want to put this in your repo and run it via npx and tsx as such:

First make sure you have the dependencies with npm/yarn/pnpm. You need ignore, lodash and yargs

npx tsx src/scripts/serialize-repo.ts
function foo(a) {
console.log(a.b)
}
foo({})
function power2(a) {
return a * a;
}
power2('string')
/**
* Create an input element
*/
function createInput(type: 'text', value: string): HTMLInputElement;
function createInput(type: 'checkbox', value: boolean): HTMLInputElement;
function createInput(type, value) {
// code
}
const input = createInput('checkbox', 'false')
/**
* Create an input element
* @param {string} type
* @param {string|boolean} value
* @return {HTMLInputElement}
*/
function createInput(type, value) {
const el = document.createElement('input');
el.type = type;
if (type === 'checkbox') {
@mohsen1
mohsen1 / HydratableStore.tsx
Created July 31, 2017 21:20
How to hydrate stores in the server with MobX
import * as React from 'react';
import { computed } from 'mobx';
import { inject, observer, Provider } from 'mobx-react';
import { fromPromise } from 'mobx-utils';
import {StaticRouter} from 'react-router-dom';
import { Request, Response } from 'express';
import * as ReactDOM from 'react-dom/server';
interface Item {
weight: number;
import * as React from 'react';
import { RouteComponentProps } from 'react-router-dom';
interface LoadableProps<T> {
loader: (props: RouteComponentProps<T>) => (() => Promise<React.ComponentType<T>> | React.ComponentType<T>);
loading: React.ComponentType<T>;
}
export function Loadable<T>(loadableProps: LoadableProps<T>) {
return class LoadableComponent extends React.Component<RouteComponentProps<T>, { ResultComponent: React.ComponentType<T> }> {