Skip to content

Commit

Permalink
made some fixes within the benchmarks; fixed dependencies in package.…
Browse files Browse the repository at this point in the history
…json
  • Loading branch information
Poincare committed Feb 5, 2017
1 parent 0aea916 commit fdbad78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
24 changes: 8 additions & 16 deletions benchmark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const getClientInstance = () => {
addTypename: false,
});
};
/*


group((end) => {
benchmark('constructing an instance', (done) => {
Expand All @@ -74,7 +74,7 @@ group((end) => {
});

group((end) => {
benchmark('fetching a query result from mocked server', (done, setupScope) => {
benchmark('fetching a query result from mocked server', (done) => {
const client = getClientInstance();
client.query({ query: simpleQuery }).then((result) => {
done();
Expand All @@ -85,7 +85,7 @@ group((end) => {
});

group((end) => {
benchmark('write data and receive update from the cache', (done, setupScope) => {
benchmark('write data and receive update from the cache', (done) => {
const client = getClientInstance();
const observable = client.watchQuery({
query: simpleQuery,
Expand All @@ -109,8 +109,9 @@ group((end) => {

group((end) => {
// This benchmark is supposed to check whether the time
// taken to deliver updates is linear in subscribers or not.
// (Should be linear).
// taken to deliver updates is linear in the number of subscribers or not.
// (Should be linear). When plotting the results from this benchmark,
// the `meanTimes` structure can be used.
const meanTimes: { [subscriberCount: string]: number } = {};

times(50, (countR) => {
Expand Down Expand Up @@ -148,18 +149,10 @@ group((end) => {
meanTimes[iterCount.toString()] = event.target.stats.mean * 1000;
});
});
afterAll(() => {
log('Mean times: ');
Object.keys(meanTimes).forEach((key) => {
log('%s, %d', key, meanTimes[key]);
});
});

end();
});
*/

/*
times(25, (countR: number) => {
const count = (countR + 1) * 10;
const query = gql`
Expand Down Expand Up @@ -242,11 +235,10 @@ times(25, (countR: number) => {
end();
});
});
}); */
});

// Measure the amount of time it takes to read a bunch of
// objects from the cache.

times(50, (index) => {
group((end) => {
const query = gql`
Expand Down
3 changes: 2 additions & 1 deletion benchmark/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
//
// `group` is meant to provide a way to execute code that sets up the scope variables for your
// benchmark. It is only run once before the benchmark, not on every call of the code to
// be benchmarked.
// be benchmarked. The `benchmark` function is similar to the `it` function within mocha;
// it allows you to define a particular block of code to be benchmarked.


// The maximum number of iterations that a benchmark can cycle for
Expand Down

0 comments on commit fdbad78

Please sign in to comment.