Speed Up Initial Execution of Python Command Line App

后端 未结 1 1361
南旧
南旧 2021-02-14 17:44

I\'ve prototyped a command line application for quick note-taking using Python and argparse. Right now it basically just launches Vim and then shoves the buffer into a SQLite d

相关标签:
1条回答
  • 2021-02-14 17:50

    You can make use of a similar technique used by the infamous "Microsoft Office Quick Start" or the "Java Quick Start" and, IIRC even the "Adobe Fast-something"...

    The trick is to try and keep all the libraries of the program in the disk cache, all the time.

    You can get it with a simple crontab command, programmed to be run once each hour. The exact details will depend on your system, but should work with something like:

    $ crontab -e
    0 * * * * python -c 'pass'
    

    Although to me more effective you should write a simple Python script that imports all the modules your program is using and then just ends.

    0 讨论(0)
提交回复
热议问题