summaryrefslogtreecommitdiffstats
path: root/main.cpp
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 /main.cpp
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 'main.cpp')
-rw-r--r--main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index dddd40d35..903d8e5f9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -50,7 +50,8 @@ int main(int argc, char **argv)
parse_xml_exit();
mainWindow()->loadFiles(files);
mainWindow()->importFiles(importedFiles);
- run_ui();
+ if (!quit)
+ run_ui();
exit_ui();
return 0;
}