Skip to content

Instantly share code, notes, and snippets.

@vsapsai
vsapsai / include-with-broken-unused-header.m
Created November 11, 2021 02:41
Test case for https://reviews.llvm.org/D112915 that demonstrates `isImport` needs to be tracked per submodule too.
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -F %t/Frameworks %t/test.m
//--- Frameworks/NonModular.framework/Headers/NonModular.h
#ifdef ENUM_VALUE
// Requires to be included inside an enum with macro ENUM_VALUE defined.
ENUM_VALUE(Left, 0),
ENUM_VALUE(Right, 1),
#endif
@vsapsai
vsapsai / clang-performance.md
Created October 21, 2021 20:56
Potential avenues for improving clang performance. Mostly when working with modules.

Inspired by Richard Howell's change https://reviews.llvm.org/D109632 we are calling Sema::addMethodToGlobalList too much when ASTReader::ReadMethodPool.

Some debugging indicates that comments and assumptions in Sema::addMethodToGlobalList might not be correct for a modular case and ObjCMethodList *List can be longer than it was originally expected. Iterating through a long list can be expensive and in the worst case it can add O(n) complexity (that might end up being multiplied by a length of another list). So it is worth checking the length of ObjCMethodList in this method, how it can grow, should we use a different data structure for this purpose.

@vsapsai
vsapsai / synthesize-framework-chain-test.py
Last active September 18, 2021 00:53
Synthesize test cases for `Sema::addMethodTGlobalList` performance.
#!/usr/bin/env python3
# Generates a test case with a chain of framework, each of those having
# multiple classes with `init` method. The dependency chain looks like
#
# repro.m -> SynthesizedN -> SynthesizedN-1 -> ... -> Synthesized0 -> Base
import argparse
import os
@vsapsai
vsapsai / cmuratori_api_design.md
Last active October 29, 2019 05:17
Notes on the talk Designing and Evaluating Reusable Components by Casey Muratori. View in raw.

Notes on the talk Designing and Evaluating Reusable Components by Casey Muratori. https://caseymuratori.com/blog_0024

Slides are separated with ---, my comments are after ~~~.


Designing and Evaluating Reusable Components

@vsapsai
vsapsai / .block
Last active February 10, 2018 07:05
SpaceX launches to different orbits. Distribution by day and hour
license: mit
@vsapsai
vsapsai / null-character-in-literal.c
Created January 11, 2018 02:02
clang/test/Lexer/null-character-in-literal.c for https://reviews.llvm.org/D41423
// RUN: %clang_cc1 -fsyntax-only -verify %s
// This file contains literal null characters, be careful not to remove them
// accidentally.
char a = ''; // expected-warning {{null character(s) preserved in char literal}}
char b = '\'; // expected-warning {{null character(s) preserved in char literal}}
// expected-warning@-1 {{unknown escape sequence '\x0'}}
char *c = "nullcharacter"; // expected-warning {{null character(s) preserved in string literal}}
@vsapsai
vsapsai / .block
Last active October 23, 2017 02:37
Experimenting with Edward Tufte-style boxplots for requests' latencies and volume
license: mit
@vsapsai
vsapsai / thoughts.md
Last active August 15, 2017 03:39
Wishful thinking regarding serverless services.

Main usage for serverless service I have in mind is GitHub integration. Specifically, I'd like to have

  • email notifications for various events,
  • CI support for pull requests,
  • time-based issue closing.

What I expect from a serverless framework:

  • abstract away underlying provider
  • help with local development
  • monitor consumed resources
@vsapsai
vsapsai / clang_8.1.0.dot
Last active June 12, 2017 06:04
Intrinsics headers mapping
digraph mapping {
"adxintrin.h" ->"immintrin.h";
"avx2intrin.h" ->"immintrin.h";
"avx512bwintrin.h" ->"immintrin.h";
"avx512cdintrin.h" ->"immintrin.h";
"avx512dqintrin.h" ->"immintrin.h";
"avx512erintrin.h" ->"immintrin.h";
"avx512fintrin.h" ->"immintrin.h";
"avx512ifmaintrin.h" ->"immintrin.h";
"avx512ifmavlintrin.h" ->"immintrin.h";
@vsapsai
vsapsai / .block
Last active May 22, 2017 03:27
Percentile-ish income (not wealth) distribution in Canada for tax year 2014
license: mit