aboutsummaryrefslogtreecommitdiffstats
path: root/subsurfacestartup.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-11-02 12:00:16 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-02 12:51:32 -0700
commit58fa613236d59a396ab83b4549484d16fcb47579 (patch)
tree146b27e01e06a562f6d8ddd2ad9669d5b34f42d4 /subsurfacestartup.c
parent04cdfce782f2a104ab5d0ee92de67c7b6271835b (diff)
downloadsubsurface-58fa613236d59a396ab83b4549484d16fcb47579.tar.gz
Speed up XML loading
This tries to speed up XML loading for large XML files (and thus subsurface startup times) by trimming the fat off our own matching code. The actual libxml overhead (particularly string allocation) tends to be the dominant part, so this only speeds up a big load by about 12% for me, but hey, it can be noticeable. Dirk's example nasty 175MB xml file with ~5200 dives takes "only' 7.7 seconds to load, when it used to take 8.8s. And that's on a fast machine. For smaller xml files, the dynamic loading costs etc startup costs tend to be big enough that the xml parsing costs aren't as noticeable. Aside from switching the node names around to "little endian" (ie least significant name first) format to avoid some unnecessary strlen() calls, this makes the nodename generation use a non-locale 'tolower()', and only decodes up to two levels of names (since that's the maximum we ever match against anyway). It also introduces a "-q" argument to make startup timing easier. Passing in "-q" just makes subsurface quit imediately after doing all necessary startup code. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurfacestartup.c')
-rw-r--r--subsurfacestartup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index b22bdd83b..bc5cd42f4 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -104,6 +104,9 @@ void parse_argument(const char *arg)
case 'v':
verbose++;
continue;
+ case 'q':
+ quit++;
+ continue;
case '-':
/* long options with -- */
if (strcmp(arg, "--help") == 0) {