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 🙏

© 2026 – Pkg Stats / Ryan Hefner

al-perf

v2.2.0

Published

CLI tool and MCP server for analyzing Business Central .alcpuprofile files

Downloads

12

Readme

al-perf

npm version License: GPL v3 Built with Bun TypeScript MCP

Analyze Business Central .alcpuprofile files — find hotspots, detect anti-patterns, and track regressions.

Works as a CLI, web app, MCP server, or library.


Table of Contents

Install

# npm / bun
bun add al-perf

# From source
git clone https://github.com/SShadowS/al-perf.git
cd al-perf
bun install

Requires Bun >= 1.0.0.

Quick Start

# Analyze a profile
al-profile analyze profile.alcpuprofile

# With AL source correlation
al-profile analyze profile.alcpuprofile --source ./al-src

# Quick top-5 hotspots
al-profile hotspots profile.alcpuprofile

# Compare before/after
al-profile compare before.alcpuprofile after.alcpuprofile

# CI/CD quality gate (exits 1 on critical patterns)
al-profile gate profile.alcpuprofile --max-critical 0

CLI Reference

| Command | Description | |---------|-------------| | analyze <profile> | Full analysis — hotspots, patterns, app/object breakdowns | | hotspots <profile> | Quick top-N hotspot summary | | compare <before> <after> | Before/after diff — regressions and improvements | | explain <profile> <method> | Deep dive into a single method — callers, callees, times | | analyze-source <path> | Static analysis of AL source files (no profile needed) | | source-map <profile> | Map profile methods to source file locations | | gate <profile> | CI/CD quality gate — pass/fail against thresholds | | mcp | Start the MCP server (stdio transport) |

Common flags:

-f, --format <type>   Output format: terminal, json, markdown, auto (default: auto)
-t, --top <n>         Number of hotspots to show (default: 10)
-s, --source <path>   Path to AL source files for correlation
--cache               Cache the source index for faster re-analysis
--explain             Append AI-powered explanation (requires ANTHROPIC_API_KEY)
--model <name>        AI model: sonnet (default), opus

Web Server

Upload .alcpuprofile files through a browser for instant analysis.

bun run web
# → http://localhost:3010

Accepts optional source .zip files for correlation. If ANTHROPIC_API_KEY is set, results include an AI-generated explanation.

MCP Server

Expose all analysis tools to AI agents (Claude Code, Cursor, etc.):

{
  "mcpServers": {
    "al-profiler": {
      "command": "bun",
      "args": ["run", "src/mcp/index.ts"]
    }
  }
}

Tools: analyze_profile · get_hotspots · compare_profiles · explain_method · analyze_source · gate_check

Resources: pattern-docs · last-analysis

Library API

import { analyzeProfile, compareProfiles } from "al-perf";

const result = await analyzeProfile("profile.alcpuprofile", {
  top: 10,
  includePatterns: true,
  sourcePath: "./al-src",
});

for (const p of result.patterns) {
  console.log(`[${p.severity}] ${p.title}: ${p.suggestion}`);
}

Docker

docker build -t al-perf .
docker run -p 3010:3010 al-perf

# With AI explanation
docker run -p 3010:3010 -e ANTHROPIC_API_KEY=sk-ant-... al-perf

Pattern Reference

Profile-based

| Pattern | Severity | Description | |---------|----------|-------------| | High Hit Count | warning | Methods called excessively | | Repeated Siblings | critical | Same method called repeatedly at same call site | | Single Method Dominance | critical | One method consumes >50% of total time | | Deep Call Stack | warning | Call chains deeper than 30 levels | | Event Subscriber Hotspot | warning | Event subscribers consuming significant time |

Source-correlated (requires --source)

| Pattern | Severity | Description | |---------|----------|-------------| | CalcFields in Loop | critical | CalcFields/CalcSums called inside loops | | Modify in Loop | critical | Modify/ModifyAll called inside loops | | Record Op in Loop | critical | FindSet/FindFirst/Get inside loops | | Missing SetLoadFields | warning | Find operations without SetLoadFields |

Source-only (no profile needed)

| Pattern | Severity | Description | |---------|----------|-------------| | Nested Loops | warning | Loops nested inside other loops | | Unfiltered FindSet | warning | FindSet without SetRange/SetFilter | | Event Subscriber Issues | info | Event subscribers containing loops or record ops |

Development

bun install          # Install dependencies
bun test             # Run all tests
bun test <file>      # Run a single test file
bunx tsc --noEmit    # Type check
bun run build        # Generate .d.ts declarations
bun run web          # Start the web server

License

GNU GPLv3