Engineers at QwickType Software found they spend so much time copying and pasting code that they decided to build their own text editor to speed up their development workflow. After implementing their editor they found it was even slower than what they had before. They have given you their current text processing logic and have tasked you with reimplementing it with a focus on performance.
- Analysis different approach to copy and paste the *.py files in "CopyFrom" folder to "CopyTo" folder;
- Measure the time efficiency for each approach
- Clear out the "CopyTo" directory after each measurement
- Output the best approach ranking according to each time consumption
- Use PySimpleGUI to create a interface. input: outsource/inputsource directory
Research on different approach:
- shutil copyfile(): 0:00:00.013696
- shutil CopyObj(): 0:00:00.007557
- thread: 0:00:00.014585
- muliple process: 0:00:00.056398
In general: the best performance to worst performance: ['shutil copyfile()', 'shutil CopyObj()', 'thread', 'muliple process']
Due to focus on time efficiency, I test five different approach copy & paste, the best one is CopyFile() from shutil package. The GUI can extend to any specifc type of files. Users only need to specify the In/Out directory and then the selected type of file would be transferred!
Even though I only measuring copy python files efficiency, the code can quickly adapt to measure other type/size files!
PySimpleGUI
pip install pysimplegui
or
pip3 install pysimplegui
import sys
import shutil
from threading import Thread
from datetime import datetime
import os
import glob
from multiprocessing import Process
import subprocess
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.