]> code.delx.au - gnu-emacs-elpa/blob - benchmark/scenarios.js
Add benchmark.
[gnu-emacs-elpa] / benchmark / scenarios.js
1 'use strict';
2
3 var fs = require('fs'),
4 path = require('path'),
5 scopifier = require('../scopifier'),
6
7 jqueryPath = path.join(__dirname, 'fixtures', 'jquery-2.1.1.js'),
8 lodashPath = path.join(__dirname, 'fixtures', 'lodash-2.4.1.js'),
9 asyncPath = path.join(__dirname, 'fixtures', 'async-0.9.0.js'),
10 mkdirpPath = path.join(__dirname, 'fixtures', 'mkdirp-0.5.0.js');
11
12 suite('scopifier', function () {
13
14 var jquery, lodash, async, mkdirp;
15
16 before(function (next) {
17 fs.readFile(jqueryPath, 'utf8', function (error, contents) {
18 jquery = contents;
19 next(error);
20 });
21 });
22
23 before(function (next) {
24 fs.readFile(lodashPath, 'utf8', function (error, contents) {
25 lodash = contents;
26 next(error);
27 });
28 });
29
30 before(function (next) {
31 fs.readFile(asyncPath, 'utf8', function (error, contents) {
32 async = contents;
33 next(error);
34 });
35 });
36
37 before(function (next) {
38 fs.readFile(mkdirpPath, 'utf8', function (error, contents) {
39 mkdirp = contents;
40 next(error);
41 });
42 });
43
44 bench('jquery', function () {
45 scopifier(jquery);
46 });
47
48 bench('lodash', function () {
49 scopifier(lodash);
50 });
51
52 bench('async', function () {
53 scopifier(async);
54 });
55
56 bench('mkdirp', function () {
57 scopifier(mkdirp);
58 });
59
60 });