Numerics and SystemsPerformance Tools
Blorp by Example

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 sum.brp

Benchmark Hygiene

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

bench.brp
result: Int = loop_sum(items)
print(result.to_string())

Instrumentation

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

instrument.brp
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 sum.brp

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).to_string())
	print(pipeline_sum(items).to_string())

Try It

terminal
blorp run --profile sum-profile.brp
blorp compile sum-profile.brp