Environment information
Details
CLI:
Version: 2.5.12
Platform:
CPU Architecture: aarch64
OS: macos 27.0
CPU: Apple M1 Max
Environment:
BIOME_DISTRIBUTION: npm
JS_RUNTIME_VERSION: v24.12.0
JS_RUNTIME_NAME: node
Biome Configuration:
Status: Loaded successfully
Path: biome.json
VCS enabled: false
Enabled rule: nursery/noUnsafePlusOperands
Rule name
nursery/noUnsafePlusOperands
Playground link
https://github.com/jakeleventhal/biome-no-unsafe-plus-operands-perf-repro
The repository pins Biome 2.5.10 and 2.5.12 side by side. Run:
bun install --frozen-lockfile
bun run bench
bun run profile:2.5.10
bun run profile:2.5.12
The analyzed file contains one binary + expression. Its operands come from React Hook Form values whose type is inferred from a minimal Zod schema:
import type { UseFormReturn } from "react-hook-form";
import { z } from "zod";
const formSchema = z.object({
ounces: z.number().nonnegative(),
pounds: z.number().nonnegative(),
});
declare const form: UseFormReturn<z.infer<typeof formSchema>>;
export function getWeightInOunces() {
const ounces = form.watch("ounces");
const pounds = form.watch("pounds");
return 16 * pounds + ounces;
}
Five-run averages on the machine above:
| Version |
End-to-end average |
noUnsafePlusOperands rule time |
| 2.5.10 |
1.480s |
1.379s |
| 2.5.12 |
5.554s |
5.432s |
That is a 3.75x end-to-end slowdown and a 3.94x increase inside the rule. Removing the binary + removes the expensive rule invocation and reduces the 2.5.12 check to about 52 milliseconds.
Expected result
Biome 2.5.12 should process this expression in roughly the same time as 2.5.10. noUnsafePlusOperands should not spend more than five seconds resolving two numeric React Hook Form values.
Code of Conduct
Environment information
Details
Rule name
nursery/noUnsafePlusOperandsPlayground link
https://github.com/jakeleventhal/biome-no-unsafe-plus-operands-perf-repro
The repository pins Biome 2.5.10 and 2.5.12 side by side. Run:
The analyzed file contains one binary
+expression. Its operands come from React Hook Form values whose type is inferred from a minimal Zod schema:Five-run averages on the machine above:
noUnsafePlusOperandsrule timeThat is a 3.75x end-to-end slowdown and a 3.94x increase inside the rule. Removing the binary
+removes the expensive rule invocation and reduces the 2.5.12 check to about 52 milliseconds.Expected result
Biome 2.5.12 should process this expression in roughly the same time as 2.5.10.
noUnsafePlusOperandsshould not spend more than five seconds resolving two numeric React Hook Form values.Code of Conduct