Skip to content

Instantly share code, notes, and snippets.

@aforren1
aforren1 / gsoc2022.md
Last active September 29, 2022 04:11
Reducing Chrome’s Presentation Latency on Windows

Reducing Chrome’s Presentation Latency on Windows

Alex Forrence
email: [email protected]

Intro

For this project, I improved presentation latency in Chrome on Windows by introducing waitable swap chains. Waitable swap chains allow us to both reduce latency by shortening the queue of pending frames and aligning frame production for optimal consumption by the operating system, and reduce latency spikes by dropping frames under load.

Initial proposal:

import moderngl as mgl
import glfw
import numpy as np
import glm
import mapbox_earcut as earcut
from timeit import default_timer
from xxhash import xxh32
vao_cache = {}
@aforren1
aforren1 / bgfx-drawstress
Last active November 8, 2020 21:38
glmark2 for the NVIDIA Jetson Nano 2GB, fullscreen and default settings
Usually 10648 draw calls (22 Dim) at 60fps
@aforren1
aforren1 / tmp
Last active March 17, 2019 16:19
https://ci.appveyor.com/api/buildjobs/9lty5fdd9a8y133i/artifacts/dist/ratcave-0.8.0-cp37-cp37m-win_amd64.whl
Install raspbian (https://www.raspberrypi.org/downloads/raspbian/)
run `sudo apt update && sudo apt upgrade --yes`
Turn on desktop GL in `sudo raspi-config`
(sudo apt install mesa-utils & run glxgears for verification)
edit /boot/config.txt and add `gpu_freq=500` (overclocks the GPU from 400->500) and `gpu_mem=320` (gives the GPU more memory)
# Install preemptive kernel
apt install build-essential git linux-image-rt-amd64 -y # check with `uname -r`
# Install miniconda (update later via `conda update conda`
wget http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda # accept license, add to path
echo 'export PATH="$HOME/miniconda3/bin:$PATH"' >> ~/.bashrc
# update audio settings
class Experiment(Machine):
def is_line_crossed(self): return self.line_crossed
def reset_line(self): self.line_crossed = False
def done_countdown(self):
self.countdown_done = True
print "Done the countdown"
def start_countdown(self):

IDE

  • rstudio

Reproducible research tools

  • packrat - roughly equivalent to python's virtualenv (isolated package env)
  • drake/remake - like GNU make (I think drake is better maintained at this point, but few examples)
  • RStudio's projects - at least drops you in the right working directory & ties in with packrat
  • Make a package! - higher startup cost, but user installation is trivial
  • rocker (R through Docker)

We'll stick to 32-bit installation (to make iohub happy?)

  1. Install python 2.7.12 x86 (make sure to add python to your PATH var, just for ease-of-use)
  • We use this version solely for compatibility with the nidaqmx package (2.7.14 being compatible when it comes out)
  • Ideally, psychopy will eventually support 3.x, which is actively developed
  1. Install wheels for numpy and scipy from http://www.lfd.uci.edu/~gohlke/pythonlibs/
  • for instance, use numpy‑1.12.1+mkl‑cp27‑cp27m‑win32.whl because we're using python 2.7 on 32 bit
  • python -m pip install <path_to_numpy_whl>.whl
  • We install these two globally because they're cumbersome to keep re-installing and rather large
@aforren1
aforren1 / octave_from_source.sh
Created February 20, 2017 16:44
Condensed instructions for building octave from source on ubuntu 16.04
# install dependencies, lzip (for extracting compressed file), and checkinstall (for easy uninstall)
sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot-x11 libgraphicsmagick++1-dev libhdf5-serial-dev openjdk-8-jdk libsndfile1-dev llvm-dev lpr texinfo libgl1-mesa-dev libosmesa6-dev pstoedit portaudio19-dev libqhull-dev libqrupdate-dev libqscintilla2-dev libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libqt4-opengl-dev libsuitesparse-dev texlive libxft-dev zlib1g-dev autoconf automake bison flex gperf gzip icoutils librsvg2-bin libtool perl rsync tar lzip checkinstall
# make an octave directory
cd ~
mkdir octave
cd octave
# fetch and extract files -- go to https://ftp.gnu.org/gnu/octave/
# to see if there's a more recent version