Skip to content

Commit

Permalink
benchmarking HashMaps
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Sep 18, 2018
1 parent b678be9 commit 692bd18
Show file tree
Hide file tree
Showing 11 changed files with 2,543 additions and 1,681 deletions.
26 changes: 26 additions & 0 deletions benchmarks/hashmap.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const HashMap = require('../src/data-structures/hash-maps/hash-map');
const fs = require('fs');
const readline = require('readline');
const stream = require('stream');

describe('HashMap Performance Test', () => {
describe('#set', () => {
it('set lots of values', (done) => {
hashMap = new HashMap();

const instream = fs.createReadStream('./words.txt');
const outstream = new stream;
const rl = readline.createInterface(instream, outstream);

rl.on('line', function(line) {
console.log(line);
});

rl.on('close', function() {
expect(hashMap.collisions).toBeLessThan(1);
done();
});

});
});
});
24 changes: 24 additions & 0 deletions benchmarks/words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
the
of
and
to
a
in
for
is
on
that
by
this
with
i
you
it
not
or
be
are
from
at
as
your
Loading

0 comments on commit 692bd18

Please sign in to comment.