mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
minor cache based optimization
This commit is contained in:
parent
270ae0f080
commit
b75d7fa348
|
@ -1290,13 +1290,20 @@ def stdev(values):
|
||||||
if not values or len(values) < 2:
|
if not values or len(values) < 2:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
summa = 0.0
|
key = (values[0], values[-1], len(values))
|
||||||
avg = average(values)
|
|
||||||
|
|
||||||
for value in values:
|
if key in kb.cache.stdev:
|
||||||
summa += pow(value - avg, 2)
|
return kb.cache.stdev[key]
|
||||||
|
else:
|
||||||
|
summa = 0.0
|
||||||
|
avg = average(values)
|
||||||
|
|
||||||
return sqrt(summa/(len(values) - 1))
|
for value in values:
|
||||||
|
summa += pow(value - avg, 2)
|
||||||
|
|
||||||
|
retVal = sqrt(summa/(len(values) - 1))
|
||||||
|
kb.cache.stdev[key] = retVal
|
||||||
|
return retVal
|
||||||
|
|
||||||
def average(values):
|
def average(values):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1125,6 +1125,7 @@ def __setKnowledgeBaseAttributes():
|
||||||
kb.cache = advancedDict()
|
kb.cache = advancedDict()
|
||||||
kb.cache.content = {}
|
kb.cache.content = {}
|
||||||
kb.cache.regex = {}
|
kb.cache.regex = {}
|
||||||
|
kb.cache.stdev = {}
|
||||||
|
|
||||||
kb.commonOutputs = None
|
kb.commonOutputs = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user