adjtomo/seisflows

optimize command line tool for speedup

Closed this issue · 1 comments

bch0w commented

The command line tool can be slow to operate for simple tasks like editing a parameter file. A task like printing a parameter using the par command may take up to a few seconds (~8s on a Chinook login node) when it should likely take less than a few tenths of a second to do the underlying tasks (scan and check a text file).

This is likely because we are importing a large chunk of the SeisFlows package (and its dependencies) each time we call SeisFlows from the command line, which is unnecessary for the simple tasks.

The proposed task here is to optimize the command line tool for speed. One potential approache would be to shuffle import statements/import on the fly rather than doing a general full-package import at the top of the file.

This should help cut down on task time for the simpler commands at the cost of slightly less formal code structure. The end result is a command line tool that is useful and fast.

bch0w commented

Heavy package imports (ObsPy, Matplotlib) have been removed or shifted off the main command line tool script for speedup. commands like seisflows par have gone from multiple seconds to tenths of a second. Could be further optimized but for now this is much better