npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dynamic-runtime-optimizer

v3.0.0

Published

DynamicRuntimeOptimizer =======================

Readme

DynamicRuntimeOptimizer

ספריית JavaScript/React ללא תלות חיצונית שמבצעת אופטימיזציה חכמה בזמן ריצה לפונקציות, לולאות ורכיבים. כולל פרופיילר חי, העברת עומסים ל-Web Workers, Memoization אוטומטי, תמיכה ב-React Fiber/Scheduler ו-Overlay Debug בזמן אמת.

מבנה

  • core: אופטימיזציה לפונקציות, לולאות, Adaptive state, Plugin API.
  • profiler: פרופיילר חי (זמני ביצוע, עומס CPU, FPS, זיהוי כבדות).
  • workers: Worker Manager עם בריכת Workers, תור משימות ותקשורת Promise-based.
  • react: Hooks (useOptimizedCallback/useOptimizedMemo/useOptimizedEffect), HOC withOptimization, Fiber Tracker, אינטגרציה ל-Scheduler.
  • utils: זיהוי סביבת ריצה ופונקציות עזר.

יכולות עיקריות

  • מדידת זמן ביצוע לכל פונקציה ולרינדור קומפוננטות React.
  • מדידת עומס CPU בזמן אמת ו-FPS כדי לאמוד כבדות.
  • זיהוי אוטומטי של פונקציות כבדות לפי ממוצע + עומס נוכחי.
  • העברת פונקציות כבדות ל-Web Worker דרך Worker Manager (Pool + Queue).
  • Memoization אוטומטי לפונקציות שחוזרות על אותם ערכים.
  • אופטימיזציה ללולאות בזמן ריצה עם חלוקה לצ'אנקים אדפטיביים וקיבוע length.
  • Adaptive Optimization: קביעת tier (light/medium/strong) והעדפת offload בהתאם לעומס.
  • Overlay חי המציג heavy functions, זמני רינדור, memo/offload, מצב Worker Pool ו-tier.
  • Plugin API פנימי להרחבת מנגנון האופטימיזציה.
  • תמיכה ב-Web, Node, React Native (עם fallbacks אוטומטיים).
  • טיפוסי TypeScript מדויקים (index.d.ts).

שימוש בסיסי (JavaScript)

import {
  optimizeFunction,
  optimizeLoop,
  optimizeFor,
  profiler,
  getAdaptiveState,
  workerManager,
} from './src';

const heavyMath = optimizeFunction((x) => x * x * Math.log(x + 1));
heavyMath(42);

// לולאה גדולה – מעובדת בצ'אנקים תוך התאמה לעומס.
optimizeLoop(new Array(10_000).fill(0), (v, i, len) => i * 2)
  .then((results) => console.log(results));

// לולאת for יעילה עם קיבוע length.
optimizeFor(5_000, (i, len) => i * len);

console.table(profiler.snapshot());
console.log(getAdaptiveState(), workerManager.status());

שימוש ב-React

import React from 'react';
import {
  useOptimizedCallback,
  useOptimizedMemo,
  useOptimizedEffect,
  withOptimization,
} from './src';

function ExpensiveList({ items }) {
  const process = useOptimizedCallback((item) => item.value * 2, [items]);

  const total = useOptimizedMemo(
    () => items.reduce((sum, item) => sum + process(item), 0),
    [items],
  );

  useOptimizedEffect(() => {
    // אפקט כבד? אפשר defer עם Scheduler דרך options.defer: true
  }, [items], { name: 'ExpensiveListEffect', defer: true });

  return <div>Total: {total}</div>;
}

export default withOptimization(ExpensiveList);

Overlay Debug

  • נטען אוטומטית בדפדפן; כיבוי: window.__DRO_DISABLE_OVERLAY__ = true; לפני ה-import הראשון.
  • שליטה ב-debug: startOverlay({ debug: false }) או window.__DRO_DEBUG__ = false;.
  • מציג heavy functions, זמני רינדור, memo/offload hits, מצב Worker Pool (busy/queue) ו-tier אדפטיבי.

Plugin API

import { registerPlugin } from './src';

const unregister = registerPlugin({
  onCallStart: ({ name }) => console.log('start', name),
  onCallEnd: ({ name, duration }) => console.log('done', name, duration),
  onHeavy: ({ name, entry }) => console.warn('heavy', name, entry.avg),
});

הערות וגבולות

  • העברה ל-Web Worker מתבצעת רק עבור פונקציות סריאליזביליות (ללא סגירה על state חיצוני/Native).
  • חישוב heavy נעשה לפי ממוצע ריצה + עומס CPU/‏FPS; הסף אדפטיבי.
  • התמיכה ב-Scheduler/Fiber מותנית בזמינות הפנימית של React/Scheduler בסביבתכם.
  • ב-Node/React Native תיתכן העדר תמיכה ב-Worker/Overlay; הקוד נופל ל-fallbacks אוטומטיים.