Hi guys & ladies,
I have a feature which allows the user to create projects and view it on this page. They could import resources(pdf,img,etc) to be kept along with their projects. So now i want to create a feature which allows the user to export all their stuff and those people who are in the same group as them all neatly with pretty ribbon tied in a zip file.
Currently i'm using Archive:Zip to zip up the file preemptively, keep their CRC32 checksum and running this as a daily cronjob to cut the user waiting time down. But if there's any changes to any of the files i will have to rerun the whole thing.
My initial benchmark shows me that 103MB of file will takes up to 47secs to run. The process involve generating XML linking them to XSL, copying images, html for the iframes and what not.
I'm thinking of creating a table or a text file to keep CRC32 checksum or last modified date for all of the files in a temporarily storage area and compare with this list each time the user click on export, and if there's any new files, i will remove the same file from the cached zip file and add in the new file. Or i will just keep all the loose files and copy and replace the newer files and then do the archive on each click.
My questions are:
- Is this considered as a premature or bad optimization technique?
- How should i properly optimize this?
- Is there some book or resources that I can learn for these sort of optimization techniques?