diff --git a/README.md b/README.md index b3e5cb87..f9343d5f 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,9 @@ A [robust](https://mathiasbynens.be/notes/javascript-benchmarking "Bulletproof J ## Installation -Benchmark.js’ only hard dependency is [lodash](https://lodash.com/). -Include [platform.js](https://mths.be/platform) to populate [Benchmark.platform](https://benchmarkjs.com/docs#platform). - In a browser: ```html - - ``` @@ -35,9 +30,7 @@ In an AMD loader: ```js require({ 'paths': { - 'benchmark': 'path/to/benchmark', - 'lodash': 'path/to/lodash', - 'platform': 'path/to/platform' + 'benchmark': 'path/to/benchmark' } }, ['benchmark'], function(Benchmark) {/*…*/}); diff --git a/benchmark.js b/benchmark.js index 8861707f..7e65655f 100644 --- a/benchmark.js +++ b/benchmark.js @@ -50,7 +50,7 @@ var contextProps = [ 'Array', 'Date', 'Function', 'Math', 'Object', 'RegExp', 'String', 'clearTimeout', 'chrome', 'chromium', 'document', 'navigator', - 'platform', 'process', 'runtime', 'setTimeout' + 'process', 'runtime', 'setTimeout' ]; /** Used to avoid hz of Infinity. */ @@ -875,16 +875,9 @@ try { var result; if (freeExports && freeRequire) { - switch (id) { - case 'platform': - result = require('platform'); - break; - default: - /** Used to avoid inclusion in Browserified bundles. */ - // eg: microtime - result = freeRequire(id); - break; - } + /** Used to avoid inclusion in Browserified bundles. */ + // eg: microtime + result = freeRequire(id); } } catch (e) { } return result || null; @@ -2578,28 +2571,6 @@ 'onStart': undefined }, - /** - * Platform object with properties describing things like browser name, - * version, and operating system. See [`platform.js`](https://mths.be/platform). - * - * @static - * @memberOf Benchmark - * @type Object - */ - 'platform': context.platform || req('platform') || ({ - 'description': context.navigator && context.navigator.userAgent || null, - 'layout': null, - 'product': null, - 'name': null, - 'manufacturer': null, - 'os': null, - 'prerelease': null, - 'version': null, - 'toString': function () { - return this.description || ''; - } - }), - /** * The semantic version number. * @@ -3111,10 +3082,8 @@ // Some AMD build optimizers, like r.js, check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { // Define as an anonymous module so, through path mapping, it can be aliased. - define(['platform'], function (platform) { - return runInContext({ - 'platform': platform - }); + define('benchmark', function () { + return runInContext(); }); } else { diff --git a/doc/README.md b/doc/README.md index aba356e0..fbe98544 100644 --- a/doc/README.md +++ b/doc/README.md @@ -69,7 +69,6 @@ * `Benchmark.options.onError` * `Benchmark.options.onReset` * `Benchmark.options.onStart` -* `Benchmark.platform` * `Benchmark.support` * `Benchmark.support.browser` * `Benchmark.version` @@ -117,8 +116,8 @@ The Benchmark constructor.

-Note: The Benchmark constructor exposes a handful of lodash methods to -make working with arrays, collections, and objects easier. The lodash +Note: The Benchmark constructor exposes a handful of lodash-like methods to +make working with arrays, collections, and objects easier. The lodash-like methods are:
[`each/forEach`](https://lodash.com/docs#forEach), [`forOwn`](https://lodash.com/docs#forOwn), [`has`](https://lodash.com/docs#has), [`indexOf`](https://lodash.com/docs#indexOf), @@ -1132,18 +1131,6 @@ An event listener called when the benchmark starts running. -

Benchmark.platform

-[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L2276 "View in source") [Ⓣ][1] - -Platform object with properties describing things like browser name, -version, and operating system. See [`platform.js`](https://mths.be/platform). - ---- - - - - -

Benchmark.support

[Ⓢ](https://github.com/bestiejs/benchmark.js/blob/2.1.4/benchmark.js#L195 "View in source") [Ⓣ][1] diff --git a/example/jsperf/index.html b/example/jsperf/index.html index 68144f4a..0ca7a51f 100644 --- a/example/jsperf/index.html +++ b/example/jsperf/index.html @@ -227,8 +227,7 @@

Add a comment

· by @mathias - - + diff --git a/package.json b/package.json index 01937081..7a1991c8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,11 @@ "homepage": "https://benchmarkjs.com/", "license": "MIT", "main": "benchmark.js", - "keywords": ["benchmark", "performance", "speed"], + "keywords": [ + "benchmark", + "performance", + "speed" + ], "author": "Mathias Bynens ", "types": "types/index.d.ts", "contributors": [ @@ -24,11 +28,8 @@ "test:coverage": "nyc npm run test", "test:tsd": "tsd" }, - "dependencies": { - "lodash": "^4.17.10", - "platform": "^1.3.6" - }, "devDependencies": { + "chai": "^4.3.6", "coveralls": "^3.1.1", "docdown": "^0.7.3", "mocha": "^9.2.1", diff --git a/test/index.html b/test/index.html index 2fc01bd0..621dd738 100644 --- a/test/index.html +++ b/test/index.html @@ -1,82 +1,27 @@ - - - Benchmark.js Test Suite - - - -
- - - - - - + + - requirejs.config({ - 'baseUrl': './', - 'urlArgs': 't=' + (+new Date), - 'waitSeconds': 0, - 'packages': [ - { - 'name': 'benchmark', - 'location': '..', - 'main': 'benchmark' - }, - { - 'name': 'lodash', - 'location': '../node_modules/lodash', - 'main': 'lodash' - }, - { - 'name': 'platform', - 'location': '../node_modules/platform', - 'main': 'platform' - }, - { - 'name': 'test', - 'location': '.', - 'main': 'test' - } - ] - }); + + - // Load Benchmark as a module. - require(['benchmark'], function(Benchmark) { - benchmarkModule = window.Benchmark = Benchmark; - require(['test'], function() { - QUnit.start(); - }); - }); - }()); + + - // Set a more readable browser name. - window.onload = function() { - var timeoutId = setInterval(function() { - var ua = document.getElementById('qunit-userAgent'); - if (ua && (benchmarkModule || !window.require)) { - ua.innerHTML = platform; - clearInterval(timeoutId); - } - }, 16); - }; - - - + \ No newline at end of file diff --git a/test/test.js b/test/test.js index 8f6e0607..efbbff44 100644 --- a/test/test.js +++ b/test/test.js @@ -8,8 +8,9 @@ var root = (typeof global == 'object' && global) || this; var amd = root.define && define.amd, slice = Array.prototype.slice; -var assert = require('assert'); -var Benchmark = require('../benchmark'); +var describe = root.mocha && root.Mocha.describe || require('mocha').describe; +var assert = root.chai && root.chai.assert || require('chai').assert; +var Benchmark = root.Benchmark || require('..'); /** Used to create dummy benchmarks for comparisons. */ function generateBenchData() { @@ -46,18 +47,6 @@ describe('Benchmark', function () { this.skip(); } }); - - it('should support loading Platform.js as a module', function () { - if (amd) { - var platform = (benchmarkModule || {}).platform || {}, - name = platform.name; - - assert.ok(typeof name == 'string' || name === null); - } - else { - this.skip(); - } - }); }); /*--------------------------------------------------------------------------*/ diff --git a/types/index.d.ts b/types/index.d.ts index 962dd29d..6ded649d 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -23,7 +23,6 @@ declare class Benchmark { static reduce(arr: T[], callback: (accumulator: K, value: T) => K, thisArg?: any): K; static options: Benchmark.Options; - static platform: Benchmark.Platform; static support: Benchmark.Support; static version: string; @@ -86,18 +85,6 @@ declare namespace Benchmark { queued?: boolean | undefined; } - export interface Platform { - description: string; - layout: string; - product: string; - name: string; - manufacturer: string; - os: string; - prerelease: string; - version: string; - toString(): string; - } - export interface Support { browser: boolean; canInjectScript: boolean;