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

@kalxjs/performance

v1.2.17

Published

Performance optimization utilities for KalxJs framework

Readme

@kalxjs/performance

Performance optimization utilities for KalxJs framework.

Installation

npm install @kalxjs/performance

Usage

import { 
  lazyLoad, 
  debounce, 
  throttle, 
  memoize, 
  virtualList, 
  withPerformanceTracking 
} from '@kalxjs/performance';

// Lazy load a component
const LazyComponent = lazyLoad(() => import('./HeavyComponent.js'), {
  loading: LoadingSpinner,
  error: ErrorComponent,
  delay: 200,
  timeout: 10000
});

// Debounce a function
const debouncedSearch = debounce((query) => {
  // Search logic here
  fetchSearchResults(query);
}, 300);

// Throttle a function
const throttledScroll = throttle(() => {
  // Scroll handler logic
  updateScrollPosition();
}, 100);

// Memoize a function
const expensiveCalculation = memoize((a, b) => {
  // Complex calculation
  return a * b * Math.sqrt(a + b);
});

// Create a virtualized list
const VirtualizedList = virtualList({
  itemHeight: 50,
  overscan: 5,
  getKey: (item) => item.id
});

// Use the virtualized list
const MyList = {
  setup() {
    const items = ref([/* many items */]);
    
    return () => h(VirtualizedList, {
      items: items.value,
      renderItem: (item) => h('div', {}, item.name)
    });
  }
};

// Track component performance
const TrackedComponent = withPerformanceTracking(MyComponent, {
  name: 'MyComponent',
  logToConsole: true,
  onMeasure: (stats) => {
    // Send performance data to analytics
    analytics.trackPerformance(stats);
  }
});

Features

Lazy Loading

Load components only when they're needed to reduce initial bundle size.

Debounce & Throttle

Limit the rate at which functions are called to improve performance.

Memoization

Cache function results to avoid redundant calculations.

Virtual List

Efficiently render large lists by only rendering items in the viewport.

Performance Tracking

Measure and monitor component render performance.

API Reference

lazyLoad(factory, options)

Lazy load a component with loading and error states.

debounce(fn, wait, immediate)

Create a debounced function that delays invoking the function until after wait milliseconds.

throttle(fn, limit)

Create a throttled function that only invokes the function at most once per limit milliseconds.

memoize(fn, keyResolver)

Create a memoized function that caches results based on input arguments.

virtualList(options)

Create a virtualized list component for efficient rendering of large lists.

withPerformanceTracking(component, options)

Wrap a component with performance measurement.

License

MIT