Skip to content

Instantly share code, notes, and snippets.

@cgravier
Created February 24, 2016 12:59
Show Gist options
  • Save cgravier/15a4baf32271480a3db6 to your computer and use it in GitHub Desktop.
Save cgravier/15a4baf32271480a3db6 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
const int NPAD = 15; // on my 64 bits system
struct l {
struct l *n;
long int pad[NPAD];
};
void simpleReadWalk(l* start, int nb) {
struct l* c = start;
for (int i = 0; i < nb; i++) {
c = c->n;
}
}
int main() {
int size = sizeof(struct l);
int wsSize = 1 << 25; // working set size 2^10
int nb = wsSize / size;
struct l* start = new struct l;
struct l* current = start;
for (int i = 0; i < nb - 1; i++) {
struct l* nextone = new struct l;
current->n = nextone;
current = nextone;
}
simpleReadWalk(start, nb);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment