Skip to content

Instantly share code, notes, and snippets.

View v-fox's full-sized avatar

Sergey Kondakov v-fox

  • Russian Federation, Permskiy Kray
View GitHub Profile
@v-fox
v-fox / NVMe_tweaks.md
Last active November 5, 2024 16:50
Linux kernel optimizations for NVMe

By default Linux distros are unoptimized in terms of I/O latency. So, here are some tips to improve that.

Most apps still don't do multi-threaded I/O access, so it's a thread-per-app which makes per-app speed always bottlenecked by single-core CPU performance (that's not even accounting for stuttering on contention between multiple processes), so even with NVMe capable of 3-6 GB/s of linear read you may get only 1-2 GB/s with ideal settings and 50-150/100-400 MB/s of un/buffered random read (what apps actually use in real life) is the best you can hope for.

All writes are heavily buffered on 3 layers (OS' RAM cache, device's RAM cache, device's SLC-like on-NAND cache), so it's difficult to get real or stable numbers but writes are largelly irrelevant for system's responsiveness, so they may be sacrificed for better random reads.

The performance can be checked by:

  • `fio --name=read --readonly --rw={read/randread} --ioengine=libaio --iodepth={jobs_per_each_worker's_command} --bs={4k/2M} --direct={0/1} --num
@v-fox
v-fox / motioninterpolation.vpy
Last active September 19, 2023 00:48 — forked from phiresky/motioninterpolation.vpy
On-CPU motion interpolation for ≤480@144, ~720@120, ≥1080p@60 playback in mpv
#!/usr/bin/python
# vim: set ft=python:
# see the README at https://gist.github.com/v-fox/43c287426c366679afc4c65eece60cbc
# source: https://github.com/mpv-player/mpv/issues/2149
# source: https://github.com/mpv-player/mpv/issues/566
# source: https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.mpv/filters/mvtools.vpy
import vapoursynth as vs
import functools
@v-fox
v-fox / .zshrc
Created December 23, 2016 11:05
fancy prompt for zshrc
export BLACK="%{"$'\033[01;30m'"%}"
export GREEN="%{"$'\033[01;32m'"%}"
export RED="%{"$'\033[01;31m'"%}"
export YELLOW="%{"$'\033[01;33m'"%}"
export BLUE="%{"$'\033[01;34m'"%}"
export BOLD="%{"$'\033[01;39m'"%}"
export NORM="%{"$'\033[00m'"%}"
if [ "`id -u`" = "0" ]; then
PROMPT="@${RED}%M${NORM} (${YELLOW}%D - %*${NORM}) [ ${BLUE}%~${NORM} ] ${RED}##${NORM} ";