Skip to content

Commit

Permalink
Fixed Apple GPU sometimes returning Infinity performance
Browse files Browse the repository at this point in the history
  • Loading branch information
SBRK committed Jun 2, 2021
1 parent 4abf2f7 commit 640ae86
Show file tree
Hide file tree
Showing 14 changed files with 15,795 additions and 9,573 deletions.
2 changes: 1 addition & 1 deletion data/database.json

Large diffs are not rendered by default.

8,338 changes: 4,989 additions & 3,349 deletions data/notebookcheck-gpus.json

Large diffs are not rendered by default.

4,614 changes: 2,799 additions & 1,815 deletions data/videocard-benchmark-gpus.json

Large diffs are not rendered by default.

1,273 changes: 658 additions & 615 deletions dist/database.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/database.js.map

Large diffs are not rendered by default.

7,802 changes: 4,016 additions & 3,786 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3,174 changes: 3,173 additions & 1 deletion package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.2",
"scripts": {
"build": "rollup -c",
"build:watch": "rollup -c -w",
"regenerate-database": "node scripts/generate-normalized-database.js",
"download-data": "node scripts/download-gpu-data.js && npm run regenerate-database",
"log-matches": "node scripts/print-db-matches.js > data/db-matches.txt && node scripts/print-sample-matches.js > data/sample-matches.txt"
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-normalized-database.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const VB = require('./fetch-videocard-benchmark.js');
const TP = require('./fetch-techpowerup-specs.js');
const NC = require('./fetch-notebookcheck-specs.js');
const { findMatch_old } = require('../umd/utils.js');
const { findMatch_old } = require('../dist/utils.js');
const fs = require('fs');
const path = require('path');
const _ = require('lodash')
Expand Down
15 changes: 14 additions & 1 deletion src/apple-device-detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ function detectAppleDevice(gpu) {

const pixelRatio = window.devicePixelRatio

let type

const userAgent = window.navigator.userAgent.toLowerCase()
// WIP
// const iosVersion = userAgent.match(/CPU OS ([0-9]*)/)[1]

if (userAgent.includes('ipad')) {
type = 'iPad'
} else if (userAgent.includes('iphone') || userAgent.includes('ipod')) {
type = 'iPhone'
}

const results = []

if (!gpu) {
Expand All @@ -42,7 +54,8 @@ function detectAppleDevice(gpu) {
if (
device.width !== width ||
device.height !== height ||
device.pixelRatio !== pixelRatio
device.pixelRatio !== pixelRatio ||
device.type && device.type !== type
) {
return
}
Expand Down
Loading

0 comments on commit 640ae86

Please sign in to comment.