Early preview: syntax, standard library APIs, and tooling may change.

Numerics and SystemsPerformance Tools

Performance Tools

Blorp aims for native code while keeping safety checks visible in the source model.

--profile

blorp run --profile and blorp test --profile print timing information.

terminal
blorp run --profile-mode calls examples/docs/numerics-and-systems/performance-tools/sum-profile.brp

Benchmark Hygiene

Keep inputs stable, avoid printing inside timed loops, and compare whole programs rather than isolated guesses.

result: Int = loop_sum(items)
print(result)

Instrumentation

Use small named functions so profile output and compiler errors point to the part being measured.

pure func measured_sum(items: List[Int]) -> Int:
	loop_sum(items)

Generated C Preview

blorp compile can emit C when you need to inspect the lowered shape lightly.

terminal
blorp compile -o /tmp/sum-profile.c examples/docs/numerics-and-systems/performance-tools/sum-profile.brp

Allocation Explanations

--explain-allocations reports allocation risks in final Core and emits no C. Unsupported coverage is not an allocation-free guarantee; no_alloc enforcement is not implemented.

terminal
blorp compile --explain-allocations=human examples/docs/numerics-and-systems/performance-tools/sum-profile.brp
blorp compile --explain-allocations=json examples/docs/numerics-and-systems/performance-tools/sum-profile.brp

Release Builds

Measure release builds with stable inputs, retaining the compiler, source, flags, and outputs.

terminal
blorp run --release examples/docs/numerics-and-systems/performance-tools/sum-profile.brp
blorp compile -o /tmp/sum-profile.c examples/docs/numerics-and-systems/performance-tools/sum-profile.brp
cc -O2 -fwrapv /tmp/sum-profile.c -o /tmp/sum-profile -lm -lpthread
/tmp/sum-profile

Example

sum-profile.brp
import:
	list: map


pure func loop_sum(items: List[Int]) -> Int:
	var total: Int = 0
	for item in items:
		total += item
	total


pure func pipeline_sum(items: List[Int]) -> Int:
	loop_sum(items.map(pure func(x): x))


func main(args: List[String]) -> Void:
	items: List[Int] = [1, 2, 3, 4, 5]
	print(loop_sum(items)) -- prints: 15
	print(pipeline_sum(items)) -- prints: 15

Try it

terminal
blorp run --profile-mode calls examples/docs/numerics-and-systems/performance-tools/sum-profile.brp
blorp compile --explain-allocations examples/docs/numerics-and-systems/performance-tools/sum-profile.brp