File tree 5 files changed +26
-1
lines changed
5 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
test.rb
2
+ profile.json
Original file line number Diff line number Diff line change @@ -5,3 +5,5 @@ source "https://rubygems.org"
5
5
gemspec
6
6
7
7
gem "prism"
8
+ gem "vernier"
9
+ gem "profile-viewer"
Original file line number Diff line number Diff line change 8
8
GEM
9
9
remote: https://rubygems.org/
10
10
specs:
11
+ optparse (0.5.0 )
11
12
prettier_print (1.2.1 )
12
13
prism (0.30.0 )
14
+ profile-viewer (0.0.2 )
15
+ optparse
16
+ webrick
17
+ vernier (1.0.1 )
18
+ webrick (1.8.1 )
13
19
14
20
PLATFORMS
15
21
arm64-darwin-22
16
22
arm64-darwin-23
17
23
18
24
DEPENDENCIES
19
25
prism
26
+ profile-viewer
20
27
syntax_tree-prism !
28
+ vernier
21
29
22
30
BUNDLED WITH
23
31
2.4.13
Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ require "benchmark"
7
7
$:. unshift ( File . expand_path ( "../lib" , __dir__ ) )
8
8
require "syntax_tree/prism"
9
9
10
- filepaths = Dir [ File . expand_path ( "../../ruby/prism/test/prism/fixtures/**/*.txt" ) ]
10
+ filepaths = Dir [ File . expand_path ( "../../rails/rails/activerecord/**/*.rb" ) ]
11
+ puts "Formatting #{ filepaths . length } files"
11
12
12
13
Benchmark . bmbm do |x |
13
14
x . report ( "format" ) do
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require " bundler/setup"
5
+ require " vernier"
6
+
7
+ $:.unshift(File.expand_path(" ../lib" , __dir__))
8
+ require " syntax_tree/prism"
9
+
10
+ results = Dir[File.expand_path(" ../../rails/rails/activerecord/**/*.rb" )].map { | filepath| Prism.parse_file(filepath) }
11
+ puts " Profiling #{results.length} files"
12
+
13
+ Vernier.trace(out: " profile.json" ) { results.each(& :format) }
You can’t perform that action at this time.
0 commit comments