⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (333 Bytes)
Bug #18144
» no_timeout.rb
duerst (Martin Dürst)
, 09/02/2021 06:44 AM
require
'timeout'
text
=
'"a'
*
80_000
re
=
"[
\"
']([^
\"
']+)[
\"
'].*END"
puts
re
.
inspect
regexp
=
Regexp
.
compile
(
re
)
match
=
nil
t1
=
t2
=
0
begin
Timeout
::
timeout
(
10
)
do
t1
=
Time
.
now
match
=
text
.
match
regexp
t2
=
Time
.
now
end
puts
"match:
#{
!!
match
}
, time:
#{
t2
-
t1
}
"
rescue
Timeout
::
Error
puts
"timeout"
end
(1-1/1)
Loading...