Giter Site home page Giter Site logo

deno_plugin_num_cpus's Introduction

deno_plugin_num_cpus

Build Status tag Crates.io Docs.rs license

Rust num_cpus binding for Deno.

Get the number of CPUs available on the current system.

Sometimes the CPU will exaggerate the number of CPUs it contains, because it can use processor tricks to deliver increased performance when there are more threads. This crate provides methods to get both the logical and physical numbers of cores.

This information can be used as a guide to how many tasks can be run in parallel. There are many properties of the system architecture that will affect parallelism, for example memory access speeds (for all the caches and RAM) and the physical architecture of the processor, so the number of CPUs should be used as a rough guide only.

Ops

op_num_cpus

Get the number of CPUs available on the current system.

Use in Deno:

const { op_num_cpus } = Deno.core.ops();
const response: Uint8Array = Deno.core.dispatch(op_num_cpus)!;

Returned Binary Layout:

+----------------+----------------+----------------+----------------+
|   NUM_CPUS (8) |                |                |                |
+----------------+----------------+----------------+----------------+

The number of cpu on each machine will not be greater than 256(2^8), so we use 1 byte to pass the return value.

License

deno_plugin_num_cpus is released under the MIT License. See the bundled LICENSE file for details.

deno_plugin_num_cpus's People

Contributors

justjavac avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.