File tree Expand file tree Collapse file tree 9 files changed +9
-9
lines changed Expand file tree Collapse file tree 9 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 66require "addressable/uri"
77
88run_benchmark ( 100 ) do
9- 100 . times do
9+ 10000 . times do
1010 # URI equality comparison
1111 uri1 = Addressable ::URI . parse ( "http://example.com" )
1212 uri2 = Addressable ::URI . parse ( "http://example.com:80/" )
Original file line number Diff line number Diff line change 88COMPLEX_URI = "https://user:pass@example.com:8080/path/to/resource?query=value&foo=bar#fragment"
99
1010run_benchmark ( 100 ) do
11- 100 . times do
11+ 10000 . times do
1212 # Component access
1313 uri = Addressable ::URI . parse ( COMPLEX_URI )
1414 uri . scheme
Original file line number Diff line number Diff line change 66require "addressable/uri"
77
88run_benchmark ( 100 ) do
9- 100 . times do
9+ 10000 . times do
1010 # URI joining
1111 base = Addressable ::URI . parse ( "http://example.com/a/b/c" )
1212 base . join ( "../d" )
Original file line number Diff line number Diff line change 88SIMPLE_URI = "http://example.com/path"
99
1010run_benchmark ( 100 ) do
11- 100 . times do
11+ 10000 . times do
1212 # URI merging
1313 uri = Addressable ::URI . parse ( SIMPLE_URI )
1414 uri . merge ( scheme : "https" , port : 8080 )
Original file line number Diff line number Diff line change 66require "addressable/uri"
77
88run_benchmark ( 100 ) do
9- 100 . times do
9+ 10000 . times do
1010 # URI construction from hash
1111 Addressable ::URI . new (
1212 scheme : "https" ,
Original file line number Diff line number Diff line change 66require "addressable/uri"
77
88run_benchmark ( 100 ) do
9- 100 . times do
9+ 10000 . times do
1010 # URI normalization
1111 uri = Addressable ::URI . parse ( "HTTP://EXAMPLE.COM:80/path" )
1212 uri . normalize
Original file line number Diff line number Diff line change 1010COMPLEX_URI = "https://user:pass@example.com:8080/path/to/resource?query=value&foo=bar#fragment"
1111
1212run_benchmark ( 100 ) do
13- 100 . times do
13+ 10000 . times do
1414 # URI parsing - simple and complex
1515 Addressable ::URI . parse ( SIMPLE_URI )
1616 Addressable ::URI . parse ( COMPLEX_URI )
Original file line number Diff line number Diff line change 88SIMPLE_URI = "http://example.com/path"
99
1010run_benchmark ( 100 ) do
11- 100 . times do
11+ 10000 . times do
1212 # Component modification
1313 uri = Addressable ::URI . parse ( SIMPLE_URI )
1414 uri . scheme = "https"
Original file line number Diff line number Diff line change 88COMPLEX_URI = "https://user:pass@example.com:8080/path/to/resource?query=value&foo=bar#fragment"
99
1010run_benchmark ( 100 ) do
11- 100 . times do
11+ 10000 . times do
1212 # URI to string conversion
1313 uri = Addressable ::URI . parse ( COMPLEX_URI )
1414 uri . to_s
You can’t perform that action at this time.
0 commit comments