Bug 504422 - Be smarter with our strings for AUTOCOMPLETE_MATCH SQL function.

Avoid copying are argument strings.  String copying was showing up as 1% of the
time spent in our function, when we should almost never need to copy.
r=dwitte
r=dietrich
This commit is contained in:
Shawn Wilsher
2009-07-22 11:47:29 -07:00
parent a27b3e610d
commit 9636e1e848
3 changed files with 33 additions and 71 deletions

View File

@@ -1,46 +0,0 @@
import sys, glob, os, subprocess, logging
__all__ = [
"addCommonOptions",
"checkForCrashes",
]
log = logging.getLogger()
def addCommonOptions(parser, defaults={}):
parser.add_option("--xre-path",
action = "store", type = "string", dest = "xrePath",
# individual scripts will set a sane default
default = None,
help = "absolute path to directory containing XRE (probably xulrunner)")
if 'SYMBOLS_PATH' not in defaults:
defaults['SYMBOLS_PATH'] = None
parser.add_option("--symbols-path",
action = "store", type = "string", dest = "symbolsPath",
default = defaults['SYMBOLS_PATH'],
help = "absolute path to directory containing breakpad symbols")
def checkForCrashes(dumpDir, symbolsPath, testName=None):
stackwalkPath = os.environ.get('MINIDUMP_STACKWALK', None)
# try to get the caller's filename if no test name is given
if testName is None:
try:
testName = os.path.basename(sys._getframe(1).f_code.co_filename)
except:
testName = "unknown"
foundCrash = False
dumps = glob.glob(os.path.join(dumpDir, '*.dmp'))
for d in dumps:
log.info("TEST-UNEXPECTED-FAIL | %s | application crashed (minidump found)", testName)
if symbolsPath and stackwalkPath:
nullfd = open(os.devnull, 'w')
# eat minidump_stackwalk errors
subprocess.call([stackwalkPath, d, symbolsPath], stderr=nullfd)
nullfd.close()
os.remove(d)
extra = os.path.splitext(d)[0] + ".extra"
if os.path.exists(extra):
os.remove(extra)
foundCrash = True
return foundCrash