Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
detect-gpu
Advanced tools
Classify GPU's based on their benchmark score in order to provide an adaptive experience.
The detect-gpu npm package is designed to detect the GPU (Graphics Processing Unit) of the user's device. It provides information about the GPU model, vendor, and performance tier, which can be useful for optimizing graphics-intensive applications.
Detect GPU Information
This feature allows you to detect the GPU information of the user's device. The `getGPUTier` function returns an object containing the GPU model, vendor, and performance tier.
const { getGPUTier } = require('detect-gpu');
(async () => {
const gpuTier = await getGPUTier();
console.log(gpuTier);
})();
Asynchronous GPU Detection
This feature allows you to perform GPU detection asynchronously with custom tier settings for mobile and desktop devices. The `getGPUTier` function can be customized to return different performance tiers based on the device type.
const { getGPUTier } = require('detect-gpu');
(async () => {
const gpuTier = await getGPUTier({ mobileTiers: [0, 1, 2, 3], desktopTiers: [0, 1, 2, 3] });
console.log(gpuTier);
})();
gpu.js is a JavaScript library for GPU-accelerated computing in the browser. It allows you to run complex computations on the GPU, which can significantly speed up performance for certain tasks. Unlike detect-gpu, which focuses on detecting GPU information, gpu.js is designed for leveraging the GPU for computational tasks.
webgl-detect is a package that helps in detecting WebGL capabilities of the user's browser. It provides information about the WebGL version, supported extensions, and renderer details. While detect-gpu focuses on GPU detection, webgl-detect is more about understanding the WebGL capabilities of the browser.
Classify GPU's based on their benchmark score in order to provide an adaptive experience.
In the current state detect-gpu
should be considered to be experimental and should not yet be used in production.
If you are interested in helping me out collecting renderer names please add the following script tag to your webpage:
<script defer src="https://unpkg.com/detect-gpu/scripts/analytics_embed.js"></script>
The script simply checks the name of the users unmasked renderer and sends it as a Google Analytics event to my account. The contents of the script can be found here.
Make sure you have Node.js installed.
$ npm install detect-gpu
detect-gpu
uses benchmarking scores in order to determine what tier should be assigned to the user's GPU. If no WebGLContext
can be created or the GPU is blacklisted TIER_0
is assigned. One should provide a HTML fallback page that a user should be redirected to.
By default are all GPU's that have met these preconditions classified as TIER_1
. Using user agent detection a distinction is made between mobile (mobile and tablet) prefixed using GPU_MOBILE_
and desktop devices prefixed with GPU_DESKTOP_
. Both are then followed by TIER_N
where N
is the tier number.
In order to keep up to date with new GPU's coming out detect-gpu
splits the benchmarking scores in 4 tiers
based on rough estimates of the market share.
By default detect-gpu
assumes 15%
of the lowest scores to be insufficient to run the experience and is assigned TIER_0
. 35%
of the GPU's are considered good enough to run the experience and are assigned TIER_1
. 30%
of the GPU's are considered powerful and are classified as TIER_2
. The last 20%
of the GPU's are considered to be very powerful, are assigned TIER_3
, and can run the experience with all bells and whistles.
You can tweak these percentages when registering the application as shown below:
const GPUTier = DetectGPU.getGPUTier({
mobileBenchmarkPercentages: [15, 35, 30, 20], // [TIER_0, TIER_1, TIER_2, TIER_3]
desktopBenchmarkPercentages: [15, 35, 30, 20], // [TIER_0, TIER_1, TIER_2, TIER_3]
forceRendererString: "Apple A11 GPU", // (Development) Force a certain renderer string
forceMobile: true // (Development) Force the use of mobile benchmarking scores
});
$ npm start
$ npm run serve
$ npm run lint
$ npm run dist
$ npm run deploy
$ npm run parse-analytics
$ npm run update-benchmarks
My work is released under the MIT license.
detect-gpu
uses both mobile and desktop benchmarking scores from https://www.notebookcheck.net/.
The unmasked renderers have been gathered using the analytics script that one can find in scripts/analytics_embed.js
.
FAQs
Classify GPU's based on their benchmark score in order to provide an adaptive experience.
The npm package detect-gpu receives a total of 394,365 weekly downloads. As such, detect-gpu popularity was classified as popular.
We found that detect-gpu demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.