Use this skill when the user asks to run benchmarks, profile performance, measure allocations, optimize render speed, find hot paths, generate a flamegraph, or mentions stackprof, memory profiling, or performance optimization.
Guide for measuring and improving LiquidIL render performance.
rake bench
Runs 11 real-world templates comparing liquid_ruby, liquid_il (VM), liquid_il_compiled, and liquid_il_optimized_compiled. Shows compile time, render time, and speedup ratios.
bundle exec ruby bench_partials.rb
Focused on partial rendering performance with allocation tracking. Useful for optimizing isolated scope / render tag performance.
bundle exec ruby bench_partials.rb --iterations 100 # Quick runs
bundle exec ruby bench_partials.rb --help # All options
Profile all benchmarks:
bundle exec ruby bench_partials.rb --profile stackprof --iterations 500
Profile a specific benchmark (recommended for focused analysis):
bundle exec ruby bench_partials.rb --profile stackprof --profile-benchmark bench_ecommerce_product_page --iterations 1000
View results:
bundle exec stackprof tmp/stackprof_*.dump --text --limit 30
Drill into a specific method:
bundle exec stackprof tmp/stackprof_*.dump --method 'ClassName#method_name'
Generate flamegraph:
bundle exec stackprof tmp/stackprof_*_liquid_il.dump --d3-flamegraph > tmp/flamegraph.html
open tmp/flamegraph.html
bundle exec ruby bench_partials.rb --profile memory --profile-benchmark bench_ecommerce_product_page --iterations 100
Results saved to tmp/memory_*.txt.
For profiling just the render phase (excluding compile time):
bundle exec ruby profile_render.rb
==================================
Mode: wall(100)
Samples: 2866 (0.00% miss rate)
GC: 231 (8.06%) <- GC overhead, lower is better
==================================
TOTAL (pct) SAMPLES (pct) FRAME
531 (18.5%) 362 (12.6%) #<Module:...>#__write_output__
bench_partials.rb to get current numbersBefore:
def capturing? = registers["capture_stack"].any?
After:
def initialize
@capture_stack = [] # Eager init
end
def capturing? = !@capture_stack.empty?
Before:
def output_string(value)
value = value.to_liquid if value.respond_to?(:to_liquid)
# ...
end
After:
def output_string(value)
case value
when String then value
when Integer, Float then value.to_s
when nil then ""
else
value = value.to_liquid if value.respond_to?(:to_liquid)
to_s(value)
end
end
||=| File | Purpose |
|------|---------|
| bench_partials.rb | Main benchmark runner with allocation tracking |
| profile_render.rb | Focused render-only profiling |
| benchmarks/partials.yml | Benchmark test cases |
| lib/liquid_il/context.rb | RenderScope (hot path for partials) |
| lib/liquid_il/utils.rb | output_string, to_s (called on every output) |
| lib/liquid_il/ruby_compiler.rb | write_output and compiled helpers |
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer