File tree Expand file tree Collapse file tree 4 files changed +23
-27
lines changed Expand file tree Collapse file tree 4 files changed +23
-27
lines changed Original file line number Diff line number Diff line change 33source "https://rubygems.org"
44
55gemspec
6-
7- gem "benchmark-ips"
8- gem "parser"
9- gem "ruby_parser"
10- gem "stackprof"
Original file line number Diff line number Diff line change 66GEM
77 remote: https://rubygems.org/
88 specs:
9- ast (2.4.2 )
10- benchmark-ips (2.10.0 )
119 docile (1.4.0 )
1210 minitest (5.15.0 )
13- parser (3.1.2.0 )
14- ast (~> 2.4.1 )
1511 rake (13.0.6 )
16- ruby_parser (3.19.1 )
17- sexp_processor (~> 4.16 )
18- sexp_processor (4.16.0 )
1912 simplecov (0.21.2 )
2013 docile (~> 1.1 )
2114 simplecov-html (~> 0.11 )
2215 simplecov_json_formatter (~> 0.1 )
2316 simplecov-html (0.12.3 )
2417 simplecov_json_formatter (0.1.3 )
25- stackprof (0.2.19 )
2618
2719PLATFORMS
2820 arm64-darwin-21
@@ -32,14 +24,10 @@ PLATFORMS
3224 x86_64-linux
3325
3426DEPENDENCIES
35- benchmark-ips
3627 bundler
3728 minitest
38- parser
3929 rake
40- ruby_parser
4130 simplecov
42- stackprof
4331 syntax_tree !
4432
4533BUNDLED WITH
Original file line number Diff line number Diff line change 11#!/usr/bin/env ruby
22# frozen_string_literal: true
33
4- require "bundler/setup"
5- require "benchmark/ips"
4+ require "bundler/inline"
65
7- require_relative "../lib/syntax_tree"
8- require "ruby_parser"
9- require "parser/current"
6+ gemfile do
7+ source "https://rubygems.org"
8+ gem "benchmark-ips"
9+ gem "parser" , require : "parser/current"
10+ gem "ruby_parser"
11+ end
12+
13+ $:. unshift ( File . expand_path ( "../lib" , __dir__ ) )
14+ require "syntax_tree"
1015
1116def compare ( filepath )
1217 prefix = "#{ File . expand_path ( ".." , __dir__ ) } /"
@@ -30,7 +35,7 @@ filepaths = ARGV
3035if filepaths . empty?
3136 filepaths = [
3237 File . expand_path ( "bench" , __dir__ ) ,
33- File . expand_path ( "../lib/syntax_tree.rb" , __dir__ )
38+ File . expand_path ( "../lib/syntax_tree/node .rb" , __dir__ )
3439 ]
3540end
3641
Original file line number Diff line number Diff line change 11#! /usr/bin/env ruby
22# frozen_string_literal: true
33
4- require " bundler/setup"
5- require " stackprof"
4+ require " bundler/inline"
5+
6+ gemfile do
7+ source " https://rubygems.org"
8+ gem " stackprof"
9+ end
610
711$:.unshift(File.expand_path(" ../lib" , __dir__))
812require " syntax_tree"
1620
1721GC.enable
1822
19- ` bundle exec stackprof --d3-flamegraph tmp/profile.dump > tmp/flamegraph.html`
20- puts " open tmp/flamegraph.html"
23+ File.open(" tmp/flamegraph.html" , " w" ) do | file|
24+ report = Marshal.load(IO.binread(" tmp/profile.dump" ))
25+ StackProf::Report.new(report).print_d3_flamegraph(file)
26+ end
27+
28+ ` open tmp/flamegraph.html`
You can’t perform that action at this time.
0 commit comments