Class: OxideBenchmarker

OxideBenchmarker

new OxideBenchmarker()

Downloads resources and uses them to run a crude speed test. As a side effect the resources will be cached by your browser after the test, so the benchmarker can double as a preloader.
Source:

Members

benchmarkQueue :Array

Holds the queue of resources to load. Resources are not loaded concurrently to prevent different benchmarks from slowing eachother down.
Type:
  • Array
Source:

benchmarkResults :Array

Holds the results of the speeds tests grouped by url
Type:
  • Array
Source:

benchmarkState :string

Read and updated by the benchmark queue handler to prevent concurrent resource loads. Can be one of these values: - BENCHMARK_STATE_IDLE: not doing any requests and the benchmark queue is empty, any call to benchmark() now would not interfere with other calls. - BENCHMARK_STATE_QUEUE: not doing any request right now but there are still items in the queue, a call to benchmark() now would slow down handling of the queue - BENCHMARK_STATE_BUSY: busy doing one or more requests, a call to benchmark() now would reduce reliability of the results
Type:
  • string
Source:

Methods

benchmark(resource)

Benchmarks an item immediately. Used by the benchmark queue handler.
Parameters:
Name Type Description
resource the url of the resource to load.
Source:

getSpeed() → {number}

Calculates the average speed over all completed benchmarks in the result table. Returned value is in kilobytes (SI definition) per second.
Source:
Returns:
Type
number

load(resource)

Adds a resource to the benchmark queue.
Parameters:
Name Type Description
resource the url of the resource to load.
Source:

work()

Processes the current benchmark queue.
Source:

worker()

Benchmark queue handler. If for any reason you want to stop it, call clearTimeout() on this.
Source: