File tree 4 files changed +23
-27
lines changed
4 files changed +23
-27
lines changed Original file line number Diff line number Diff line change 3
3
source "https://rubygems.org"
4
4
5
5
gemspec
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 6
6
GEM
7
7
remote: https://rubygems.org/
8
8
specs:
9
- ast (2.4.2 )
10
- benchmark-ips (2.10.0 )
11
9
docile (1.4.0 )
12
10
minitest (5.15.0 )
13
- parser (3.1.2.0 )
14
- ast (~> 2.4.1 )
15
11
rake (13.0.6 )
16
- ruby_parser (3.19.1 )
17
- sexp_processor (~> 4.16 )
18
- sexp_processor (4.16.0 )
19
12
simplecov (0.21.2 )
20
13
docile (~> 1.1 )
21
14
simplecov-html (~> 0.11 )
22
15
simplecov_json_formatter (~> 0.1 )
23
16
simplecov-html (0.12.3 )
24
17
simplecov_json_formatter (0.1.3 )
25
- stackprof (0.2.19 )
26
18
27
19
PLATFORMS
28
20
arm64-darwin-21
@@ -32,14 +24,10 @@ PLATFORMS
32
24
x86_64-linux
33
25
34
26
DEPENDENCIES
35
- benchmark-ips
36
27
bundler
37
28
minitest
38
- parser
39
29
rake
40
- ruby_parser
41
30
simplecov
42
- stackprof
43
31
syntax_tree !
44
32
45
33
BUNDLED WITH
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env ruby
2
2
# frozen_string_literal: true
3
3
4
- require "bundler/setup"
5
- require "benchmark/ips"
4
+ require "bundler/inline"
6
5
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"
10
15
11
16
def compare ( filepath )
12
17
prefix = "#{ File . expand_path ( ".." , __dir__ ) } /"
@@ -30,7 +35,7 @@ filepaths = ARGV
30
35
if filepaths . empty?
31
36
filepaths = [
32
37
File . expand_path ( "bench" , __dir__ ) ,
33
- File . expand_path ( "../lib/syntax_tree.rb" , __dir__ )
38
+ File . expand_path ( "../lib/syntax_tree/node .rb" , __dir__ )
34
39
]
35
40
end
36
41
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env ruby
2
2
# frozen_string_literal: true
3
3
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
6
10
7
11
$:.unshift(File.expand_path(" ../lib" , __dir__))
8
12
require " syntax_tree"
16
20
17
21
GC.enable
18
22
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