• Stars
    star
    300
  • Rank 138,870 (Top 3 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross-browser polyfill for navigator.hardwareConcurrency

Core Estimator

Core Estimator is a cross-browser polyfill for navigator.hardwareConcurrency.

The estimator works by performing a timing attack that runs different numbers of simultaneous web workers. It measures the time it takes to run a single worker and compares this to the time it takes to run an increasing number of workers. As soon as this measurement starts to increase excessively, it has found the maximum number of web workers which can be run simultaneously without degrading performance.

Live demo

Core Estimator only provides an estimate of the number of cores on your machine. The value may fluctuate depending on the system load caused by other programs currently running.

API

void navigator.getHardwareConcurrency(function callback(int cores), optional function progress(int min, int max, int cores))
Estimates the number of cores and passes the estimate to the callback. If navigator.hardwareConcurrency is is already available (either native API or it was previously estimated), it immediately calls the callback. Use progress if you're interested in the progress of the estimation as it completes.
int navigator.hardwareConcurrency
Either the number of logical or physical CPU cores the user's device has. Which it is depends on if estimation is used. If the browser does not natively support navigator.hardwareConcurrency, this will only be available after running navigator.getHardwareConcurrency() once.

Using Core Estimator

To install, place core-estimator.js, workload.js, and the nacl_module folder in the same public directory.

Include <script src="/path/to/core-estimator.js"></script> in the pages you wish to use the Core Estimator API.

Supported browsers

  • Firefox
  • Firefox 48 (Native)
  • Chrome (Native)
  • Safari (Native)
  • Internet Explorer 10+
  • Opera (Native)
  • Edge (Native)

Forward compatibility

In the future, when browser vendors implement navigator.hardwareConcurrency natively, Core Estimator will automatically detect and use the native method instead of estimating the number of cores.

More Repositories

1

zerodrop

A stealth URL toolkit optimized for bypassing censorship filters and/or dropping malware
Go
103
star
2

oftn-bot

State of the art IRC bot library & bot for Node.js
JavaScript
90
star
3

lic

A scriptable IRC client in Node.js with a central hub that maintains a persistent connection for you.
JavaScript
15
star
4

coca

An implementation of C in JavaScript.
JavaScript
10
star
5

suit-js

A slick user-interface toolkit created in JavaScript for use with HTML5 canvas.
JavaScript
10
star
6

melody

A program to generate music from ASCII text, in order to quickly share melodies
C
9
star
7

go-reconcile

A set reconciliation library for data synchronization and de-duplication.
Go
8
star
8

quorum

A flexible proposal/voting workflow system for teams of people
CSS
5
star
9

common

Data structures and algorithm implementations that may be useful
JavaScript
3
star
10

get-tab-size

JS function to find the tab size of a document
JavaScript
3
star
11

get-random-port

Get random open port in NodeJS
JavaScript
3
star
12

DartMark

An in-browser WYSIWYG with a focus on keyboard navigation and quick prototyping
JavaScript
3
star
13

oftn-oswg.github.io

ΩF:∅ Open Source Working Group site
JavaScript
3
star
14

ts-reconcile

A set reconciliation library for data synchronization and de-duplication.
TypeScript
2
star
15

DynVol

My efforts at recreating the archival tools used by Dynamix
C
2
star
16

webpack-extract-oftn-l10n

Webpack plugin for extracting localization strings for the oftn-l10n library
JavaScript
2
star
17

flic

Design and implementation of FLIC: Frequency Layered Information Code, a barcode format designed for high information density.
JavaScript
2
star
18

share.oftn.org

OFTN Share - https://share.oftn.org
1
star
19

hermes

1
star
20

oftn-l10n

Android-style localization for ES6
JavaScript
1
star
21

gopherview

Turn your program into a movie
Go
1
star
22

FAQBot

A Simple IRC Bot to handle Frequently Asked Questions
Racket
1
star