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-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 sum-profile.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)) -- prints: 15
print(pipeline_sum(items)) -- prints: 15
Try it
terminal
blorp run --profile sum-profile.brp
blorp compile sum-profile.brp