Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

r3f-perf

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

r3f-perf

![image](https://user-images.githubusercontent.com/15867665/108375920-c34f5c00-7245-11eb-87ba-22cba3de0cb5.png)

  • 1.0.0-beta.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-20.29%
Maintainers
1
Weekly downloads
 
Created
Source

npm dependencies Status devDependencies Status npm

R3F-Perf

image

Easily monitor the performances of your @react-three/fiber application. r3f-perf.js is 6.23 KB and automatically removed in production. See Dev and production build

Installation

yarn add --dev r3f-perf

Options

headless?: false, // Without UI. See Headless section
showGraph?: true // show the graphs
chart?: {
  hz: 10, // graphs refresh frequency parameter
  length: 30, // number of values shown on the monitor
}
colorBlind?: false // Color blind colors for accessibility
trackGPU?: true // show a graph of the GPU (Experimental, might not be relevant)
openByDefault?: false // show more informations by default
className?: false // override CSS class
position?: 'top-right'|'top-left'|'bottom-right'|'bottom-left' // override position, default is top-right

Usage

Simply add the the profiler component in your app

import { Canvas } from '@react-three/fiber';
import { Perf } from 'r3f-perf';

<Canvas>
  <Perf />
</Canvas>;

Usage without interface : headless mode

import { Canvas } from '@react-three/fiber';
import { Perf, usePerf } from 'r3f-perf';

const PerfHook = () => {
  const { gl, log } = usePerf();
  console.log(gl, log);
  return null;
};

export default function App() {
  return (
    <Canvas>
      <Perf headless />
      <PerfHook />
    </Canvas>
  );
}

SSR

The tool work with any server side rendering framework. You can try with Next and @react-three/fiber using this starter : https://github.com/pmndrs/react-three-next

Dev and production build

R3F-Perf is automatically removed from the production build based on the process.env.NODE_ENV.

To render R3F-Perf even in production :

import { Perf } from 'r3f-perf/dist/r3f-perf.cjs.development.js';

You can also set the custom env variable process.env.R3F_PERF_SHOW_IN_PROD === 'SHOW'

Todo

Maintainers :

FAQs

Package last updated on 25 Mar 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc