Skip to content

Instantly share code, notes, and snippets.

View tokenrove's full-sized avatar
💭
Ill; I may be slow to respond.

Julian Squires tokenrove

💭
Ill; I may be slow to respond.
View GitHub Profile

One thing that surprises newer programmers is that the older 8-bit microcomputers from the 70s and 80s were designed to run at the speed of random memory access to DRAM and ROM. The C64 was released in 1982 when I was born and its 6502 CPU ran at 1 MHz (give or take depending on NTSC vs PAL). It had a 2-stage pipelined design that was designed to overlap execution and instruction fetch for the current and next instruction. Cycle counting was simple to understand and master since it was based almost entirely on the number of memory accesses (1 cycle each), with a 1-cycle penalty for taken branches because of the pipelined instruction fetch for the next sequential instruction. So, the entire architecture was based on keeping the memory subsystem busy 100% of the time by issuing a read or write every cycle. One-byte instructions with no memory operands like INX still take the minimum 2 cycles per instruction and end up redundantly issuing the same memory request two cycles in a row.

@pjhades
pjhades / ebpf.c
Created December 14, 2016 16:20
eBPF program to distribute incoming traffic among multiple cores in a round-robin way
int load_bpf(int mod)
{
int map_fd;
map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(int),
sizeof(uint64_t), 1);
if (map_fd < 0) {
log_error("creating BPF map failed");
return map_fd;
}
@jkominek
jkominek / updatestars.py
Last active March 26, 2022 15:21
Maintain a mirror of all your Github stars.
#!/usr/bin/python
#################
# NOTE
# Now at https://github.com/jkominek/updatestars
#################
import requests
import json
import re