Skip to content

Commit 0ed62b1

Browse files
committed
bundler/inline instead
1 parent e0e5213 commit 0ed62b1

File tree

4 files changed

+23
-27
lines changed

4 files changed

+23
-27
lines changed

Gemfile

-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,3 @@
33
source "https://rubygems.org"
44

55
gemspec
6-
7-
gem "benchmark-ips"
8-
gem "parser"
9-
gem "ruby_parser"
10-
gem "stackprof"

Gemfile.lock

-12
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,15 @@ PATH
66
GEM
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

2719
PLATFORMS
2820
arm64-darwin-21
@@ -32,14 +24,10 @@ PLATFORMS
3224
x86_64-linux
3325

3426
DEPENDENCIES
35-
benchmark-ips
3627
bundler
3728
minitest
38-
parser
3929
rake
40-
ruby_parser
4130
simplecov
42-
stackprof
4331
syntax_tree!
4432

4533
BUNDLED WITH

bin/bench

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
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

1116
def compare(filepath)
1217
prefix = "#{File.expand_path("..", __dir__)}/"
@@ -30,7 +35,7 @@ filepaths = ARGV
3035
if 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
]
3540
end
3641

bin/profile

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
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__))
812
require "syntax_tree"
@@ -16,5 +20,9 @@ end
1620

1721
GC.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`

0 commit comments

Comments
 (0)