Skip to content

Instantly share code, notes, and snippets.

View grigory-rechistov-intel's full-sized avatar
💭
Working

Grigory Rechistov grigory-rechistov-intel

💭
Working
  • Intel Corporation
  • Sweden
View GitHub Profile
/*
Adapted from answer https://stackoverflow.com/a/79598751/530714
to question "Example of a microbenchmark to demonstrate that code
inlining is not always beneficial to performance".
To build two variants of the code:
gcc -Wall -O3 -o inlinecost inlinecost.c
gcc -Wall -O3 -o inlinecost-unrolled inlinecost.c -DUNROLL
To run it and compare the latencies:
@grigory-rechistov-intel
grigory-rechistov-intel / switch-poly.cpp
Last active October 4, 2024 13:11
Replace switch-case's with polymorphism
// === Before ===
typedef enum {
Access_Vanilla,
Access_Special,
Access_Cache,
Access_Cache_L2,
Access_Invalid
} access_t;
@grigory-rechistov-intel
grigory-rechistov-intel / commit-msg
Created November 18, 2021 11:27
Git commit hook to check spelling
#!/bin/sh
# Check spelling
ASPELL=$(which aspell 2> /dev/null)
if [ $? -ne 0 ]; then
echo "Aspell not installed, unable to check spelling" >&2
else
WORDS=$(grep -v "^Change-Id:" "$1"| $ASPELL --mode=email --add-email-quote='#' list | sort -u)
if [ -n "$WORDS" ]; then
echo -ne "\e[31m"