Skip to content

Instantly share code, notes, and snippets.

View alex-xia-xia's full-sized avatar

alex.xia alex-xia-xia

View GitHub Profile
@alex-xia-xia
alex-xia-xia / LengauerTarjan.scala
Created January 15, 2021 04:52 — forked from yuzeh/LengauerTarjan.scala
Lengauer-Tarjan Dominator Tree Algorithm
object LengauerTarjan {
// Implement these three yourself
def successors(v: Int): Iterable[Int] = ???
def predecessors(v: Int): Iterable[Int] = ???
def numNodes: Int = ???
// Lifted from "Modern Compiler Implementation in Java", 2nd ed. chapter 19.2
def computeDominatorTree(): Array[Int] = {
var N = 0
/*****************************************************************************
* #ident "Id: main.c,v 3.27 2002-01-06 16:23:01+02 rl Exp "
* kaleido
*
* Kaleidoscopic construction of uniform polyhedra
* Copyright (c) 1991-2002 Dr. Zvi Har'El <rl@math.technion.ac.il>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@alex-xia-xia
alex-xia-xia / latencies.c
Created April 11, 2019 12:12 — forked from Syntaf/latencies.c
measure each cache latency
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
int i386_cpuid_caches (size_t * data_caches) {
int i;
int num_data_caches = 0;
for (i = 0; i < 32; i++) {