Skip to content

Commit 23ef65b

Browse files
committed
formatting
1 parent 1b98ad0 commit 23ef65b

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

benchmark/benchmark.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ var OPTS = ( function(args) {
1212
benchmark: /.*/,
1313
compareTo: "master",
1414
precision: 6
15-
15+
1616
};
17-
17+
1818
for ( var ii = 0; ii < args.length; ii++ ) {
1919

2020
var arg = args[ ii ];
2121

2222
switch( arg ) {
2323

2424
case "--compare-to":
25-
ret.compareTo = args[ ++ii ]
25+
ret.compareTo = args[ ++ii ];
2626
break;
2727

2828
case "--benchmark":
@@ -39,43 +39,43 @@ var OPTS = ( function(args) {
3939
}
4040

4141
}
42-
42+
4343
return ret;
44-
44+
4545
}( process.argv.slice( 2 ) ) );
4646

4747
function createSuite( name, LD ) {
4848
var suite = new Benchmark.Suite( name );
4949

5050
var benchmarks = selectionSuite( LD );
51-
51+
5252
var bmFilter = OPTS.benchmark;
5353
return benchmarks
5454
.filter( function( bm ) { return bmFilter.test( bm.name ); } )
5555
.reduce( function( s, bm ) { return s.add( bm.name, bm.fn ); },
56-
suite );
56+
suite );
5757

5858
}
5959

6060
function checkoutModuleAtPath(path) {
6161

6262
var file = tmp.fileSync();
6363

64-
var source = spawn( 'git', [
64+
var source = spawn( "git", [
6565
"show",
6666
path + ":src/ld-query.js",
6767
] ).stdout;
6868

6969
fs.writeFileSync( file.fd, source );
70-
70+
7171
return file.name;
7272

7373
}
7474

7575
var compareToPath = OPTS.compareTo;
7676

7777
var modules = [ [ "Working Copy", "../src/ld-query.js" ],
78-
[ compareToPath, checkoutModuleAtPath( compareToPath ) ] ];
78+
[ compareToPath, checkoutModuleAtPath( compareToPath ) ] ];
7979
var suites = [];
8080
var results = [];
8181

@@ -115,12 +115,12 @@ function checkSuitesForErrors(suites) {
115115

116116
throw new Error("Benchmarks failed");
117117
}
118-
118+
119119
}
120120

121121
function processResults() {
122122
checkSuitesForErrors(results);
123-
123+
124124
var current = results[ 0 ];
125125
var currentByName = current.reduce( indexBenchmarksByName, {} );
126126

@@ -135,7 +135,7 @@ function processResults() {
135135
resultTable.cell( "Benchmark", bmName );
136136
var currBM = currentByName[ bmName ];
137137
var otherBM = otherByName[ bmName ];
138-
138+
139139
resultTable.cell( current.name, currBM.mean * 1000, numberFormat );
140140
resultTable.cell( other.name, otherBM.mean * 1000, numberFormat );
141141

@@ -146,7 +146,7 @@ function processResults() {
146146
resultTable.newRow();
147147

148148
} );
149-
149+
150150
console.log( "\nResults:\n" );
151151
console.log( "Mean Execution Time (milliseconds):\n" );
152152
console.log( resultTable.toString() );
@@ -161,7 +161,7 @@ function executeSuites() {
161161

162162
} else {
163163

164-
var suite = suites.shift()
164+
var suite = suites.shift();
165165

166166
console.log("Benchmarking:", suite.name);
167167

@@ -170,11 +170,11 @@ function executeSuites() {
170170

171171
results.push( this );
172172
executeSuites();
173-
173+
174174
})
175175
.run();
176176
}
177-
177+
178178
}
179179

180180
executeSuites();

benchmark/selection.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var DATA = require( "./data/selection-tests.json" )
1+
var DATA = require( "./data/selection-tests.json" );
22
var CONTEXT = {
33
"ex": "http://www.example.org#"
4-
}
4+
};
55

66
/*
77
* We don't use `should` here since the overhead is actually significant
@@ -24,7 +24,7 @@ function assertLength( obj, expected ) {
2424
throw new Error( "Expected obj: " + obj
2525
+ " to have length: " + expected
2626
+ ", actual length: " + obj.length);
27-
27+
2828
}
2929

3030
module.exports = function ( LD ) {
@@ -35,70 +35,70 @@ module.exports = function ( LD ) {
3535
{
3636
name: "Query single value (reuse doc)",
3737
fn: function() {
38-
38+
3939
var actual = selectionDoc
4040
.query( "ex:grabThis @value" );
4141
assertEquals(actual, "One-Two");
42-
42+
4343
}
4444
},
4545
{
4646
name: "Query all values (reuse doc)",
4747
fn: function() {
48-
48+
4949
var actual = selectionDoc
5050
.queryAll( "ex:grabThis @value" );
5151
assertLength( actual, 5 );
52-
52+
5353
}
5454
},
5555
{
5656
name: "Query single value (fresh doc)",
5757
fn: function() {
58-
58+
5959
var doc = LD( DATA, CONTEXT );
6060
var actual = doc.query( "ex:grabThis @value" );
6161
assertEquals(actual, "One-Two");
62-
62+
6363
}
6464
},
6565
{
6666
name: "Query single value (fresh doc, no pathcache)",
6767
fn: function() {
68-
68+
6969
var doc = LD( DATA, CONTEXT );
7070
if (doc.withPathCaching)
7171
doc.withPathCaching(false);
7272

7373
var actual = doc.query( "ex:grabThis @value" );
7474
assertEquals(actual, "One-Two");
75-
75+
7676
}
7777
},
7878
{
7979
name: "Query all values (fresh doc)",
8080
fn: function() {
81-
81+
8282
var actual = LD( DATA, CONTEXT )
8383
.queryAll( "ex:grabThis @value" );
8484
assertLength( actual, 5 );
85-
85+
8686
}
8787
},
8888
{
8989
name: "Select all by predicate",
9090
fn: function() {
91-
91+
9292
var actual = selectionDoc
9393
.queryAll( "*[@type=four-noindex]" );
9494
assertLength( actual, 1 );
95-
95+
9696
}
9797
},
9898
{
9999
name: "Select direct child",
100100
fn: function() {
101-
101+
102102
var actual = selectionDoc
103103
.queryAll( "ex:type > ex:type" );
104104
/*
@@ -107,22 +107,22 @@ module.exports = function ( LD ) {
107107
* for now
108108
*/
109109
// assertLength( actual, 2 );
110-
110+
111111
}
112112
},
113113
{
114114
name: "Select nested",
115115
fn: function() {
116-
116+
117117
var actual = selectionDoc
118118
.query( "ex:type > ex:type[@type=four-noindex]" )
119119
.queryAll( "ex:grabThis @value" );
120120
assertLength( actual, 2 );
121-
121+
122122
}
123123
}
124124

125125
];
126-
127-
}
126+
127+
};
128128

0 commit comments

Comments
 (0)