Skip to content

Instantly share code, notes, and snippets.

View tylerellis21's full-sized avatar

Tyler Ellis tylerellis21

View GitHub Profile
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int scores[10];
void read_scores() {
int fd = open("scores.txt", O_RDONLY);
read(fd, scores, sizeof(scores));
close(fd);
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int scores[10];
void read_scores() {
int fd = open("scores.txt", O_RDONLY);
read(fd, scores, sizeof(scores));
close(fd);
@tylerellis21
tylerellis21 / vtable.cpp
Created September 6, 2015 08:24
Simple VTable Example
#include <iostream>
#include <string>
#include <vector>
#include <memory>
class Action {
public:
virtual void trigger() = 0;
};
@tylerellis21
tylerellis21 / gist:f9a7663262feaf150a83
Created July 15, 2015 04:10
A preformance report of the change.
======================== WITHOUT ========================
CPU: Intel Haswell microarchitecture, speed 3600 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 100000
samples % image name symbol name
179563 12.5333 libnvidia-glcore.so.331.113 /usr/lib/nvidia-331/libnvidia-glcore.so.331.113
77814 5.4313 cell-simulation Entity::getId() const
70720 4.9362 cell-simulation sf::Shape::updateOutline()
51316 3.5818 cell-simulation inList(Entity*, std::vector<Entity*, std::allocator<Entity*> >&)
41346 2.8859 cell-simulation (anonymous namespace)::computeNormal(sf::Vector2<float> const&, sf::Vector2<float> const&)
37680 2.6300 cell-simulation bool __gnu_cxx::operator!=<Entity**, std::vector<Entity*, std::allocator<Entity*> > >(__gnu_cxx::__normal_iterator<Entity**, std::vector<Entity*, std::allocator<Entity*> > > const&, __gnu_cxx::__normal_iterator<Enti