mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 19:23:34 +01:00
chore(deps): upgrade dependencies
Upgrade all dependencies to newest versions.
This commit is contained in:
35
vendor/github.com/dlclark/regexp2/runner.go
generated
vendored
35
vendor/github.com/dlclark/regexp2/runner.go
generated
vendored
@@ -58,10 +58,9 @@ type runner struct {
|
||||
|
||||
runmatch *Match // result object
|
||||
|
||||
ignoreTimeout bool
|
||||
timeout time.Duration // timeout in milliseconds (needed for actual)
|
||||
timeoutChecksToSkip int
|
||||
timeoutAt time.Time
|
||||
ignoreTimeout bool
|
||||
timeout time.Duration // timeout in milliseconds (needed for actual)
|
||||
deadline fasttime
|
||||
|
||||
operator syntax.InstOp
|
||||
codepos int
|
||||
@@ -1551,39 +1550,15 @@ func (r *runner) isECMABoundary(index, startpos, endpos int) bool {
|
||||
(index < endpos && syntax.IsECMAWordChar(r.runtext[index]))
|
||||
}
|
||||
|
||||
// this seems like a comment to justify randomly picking 1000 :-P
|
||||
// We have determined this value in a series of experiments where x86 retail
|
||||
// builds (ono-lab-optimized) were run on different pattern/input pairs. Larger values
|
||||
// of TimeoutCheckFrequency did not tend to increase performance; smaller values
|
||||
// of TimeoutCheckFrequency tended to slow down the execution.
|
||||
const timeoutCheckFrequency int = 1000
|
||||
|
||||
func (r *runner) startTimeoutWatch() {
|
||||
if r.ignoreTimeout {
|
||||
return
|
||||
}
|
||||
|
||||
r.timeoutChecksToSkip = timeoutCheckFrequency
|
||||
r.timeoutAt = time.Now().Add(r.timeout)
|
||||
r.deadline = makeDeadline(r.timeout)
|
||||
}
|
||||
|
||||
func (r *runner) checkTimeout() error {
|
||||
if r.ignoreTimeout {
|
||||
return nil
|
||||
}
|
||||
r.timeoutChecksToSkip--
|
||||
if r.timeoutChecksToSkip != 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
r.timeoutChecksToSkip = timeoutCheckFrequency
|
||||
return r.doCheckTimeout()
|
||||
}
|
||||
|
||||
func (r *runner) doCheckTimeout() error {
|
||||
current := time.Now()
|
||||
|
||||
if current.Before(r.timeoutAt) {
|
||||
if r.ignoreTimeout || !r.deadline.reached() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user