Created
February 24, 2016 12:59
-
-
Save cgravier/15a4baf32271480a3db6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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