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

rbxts-transform-boost

v2.0.1

Published

roblox-ts transformer: GetService hoisting, property chain caching, and loop bounds hoisting

Downloads

105

Readme

rbxts-transform-boost

A roblox-ts / rotor TypeScript transformer that improves compiled Luau performance by hoisting repeated expressions and caching property chains.

What it does

GetService hoisting

game:GetService("X") calls used two or more times in a file are hoisted to a top-level local so the lookup only happens once.

// Input
function a() { return game.GetService("RunService").Heartbeat }
function b() { return game.GetService("RunService").IsRunning }
-- Output
const _RunService = game:GetService("RunService")

local function a() return _RunService.Heartbeat end
local function b() return _RunService.IsRunning end

Property chain caching

Repeated property accesses (e.g. workspace.CurrentCamera.CFrame) inside loops or hot functions are cached into a local so the engine only walks the chain once.

// Input
for (let i = 0; i < n; i++) {
    const pos = workspace.CurrentCamera.CFrame.Position
}
-- Output
const _CFrame = workspace.CurrentCamera.CFrame
for i = 0, n - 1 do
    const pos = _CFrame.Position
end

Loop bounds hoisting

Upper bounds that are non-trivial expressions are extracted to a local so they are not re-evaluated on every iteration.

-- Before
for i = 0, someTable:size() - 1 do

-- After
const _size = someTable:size()
for i = 0, _size - 1 do

Benchmarks

Measured on a live Roblox server (published baseplate), 100,000 iterations per benchmark (10,000 for CFrame constructors). Both suites use //!native. Compiled with roblox-ts.

With transformer = GetService hoisting + property chain caching + --!strict + --!optimize 2 + type annotations (via rbxts-transform-luau) Without transformer = raw roblox-ts output (//!native only)

You can run the benchmark yourself: Boost Transformer Bench

GetService hoisting

| Benchmark | With | Without | Speedup | |---|---|---|---| | svc ×1 (baseline) | 0.112 µs | 0.320 µs | 2.9× | | svc ×2 (same service) | 0.198 µs | 0.614 µs | 3.1× | | svc ×3 (diff services) | 0.301 µs | 0.878 µs | 2.9× |

Property chain caching

| Benchmark | With | Without | Speedup | |---|---|---|---| | cam.CFrame ×3 | 0.454 µs | 0.494 µs | 1.1× | | cam.CFrame.Position ×3 | 0.443 µs | 0.885 µs | 2.0× |

Vector3 field hoisting

| Benchmark | With | Without | Speedup | |---|---|---|---| | dot (×1 each field) | 0.062 µs | 0.099 µs | 1.6× | | cross (×2 each field) | 0.057 µs | 0.151 µs | 2.6× | | lerp (×2 each field) | 0.054 µs | 0.126 µs | 2.3× | | integrate (method calls) | 0.056 µs | 0.075 µs | 1.3× |

Loop bounds hoisting

| Benchmark | With | Without | Speedup | |---|---|---|---| | sumArray (size ×1) | 0.120 µs | 0.106 µs | — | | weightedSum (size ×1) | 0.135 µs | 0.116 µs | — |

CFrame

| Benchmark | With | Without | Speedup | |---|---|---|---| | cfLookAt (ctor) | 0.146 µs | 0.142 µs | — | | cfChain (mul+angles) | 0.158 µs | 0.160 µs | — |

Installation

npm install --save-dev rbxts-transform-boost

Setup

{
  "compilerOptions": {
    "plugins": [
      {
        "transform": "rbxts-transform-boost",
        "hoist": true
      }
    ]
  }
}

Options

| Option | Type | Default | Description | |---|---|---|---| | hoist | boolean | true | Enable GetService hoisting, property chain caching, and loop bounds hoisting | | verbose | boolean | false | Log per-file stats to the console |