Speed Up Save

From Apache OpenOffice Wiki
Jump to: navigation, search

Current Save Flow

The current save flow is shown in the follow chart.

  1. Lock UI, ready for parameters and progress bar.
  2. Save data XMLs and media files into local temp directory as temp files. During this period, generally, save big content.xml and large media file is quite slower than others.
  3. Pack to zip file, still in temp directory.
  4. Copy the temp zip file as destiny file which is possible in network. The speed of this depends on the file size and the destiny location, local or network.
  5. Do clean work, send events, finish progress bar and unlock UI, user consider this as save finished.
Save flow.PNG

What User See

Think about whar user see when saving document:

  1. UI locked, indicate OpenOffice start saving and can't edit now
  2. Progress bar is running, it is during saving
  3. UI unlocked, enable editor again, saving finished

After saving finished, user will do:

  1. Go on edit(generally, frequent)
  2. Close current module(if it is the only instance, close the program, happens)

Because current save implemetation is sequentially sharing the main thread, so when the document is large, UI seems blocked a long time.

Make It Seem Be Fast

If the document is large(XML file is large, or picture is large, or both), then UI will be locked for a long time, seems it is blocked. User jugdes wether saving is finished or not only by UI locked or not, but not the doc is really saved into the old file or not.

So making UI unlocked fast will come to a fast saving impression.

What We Can Do

On solution is unlocking UI early when we gathered essential data to save, but not after all data saved locally and transferred. This will happen after saved meta.xml and others and before saving content.xml and media files like pictures. And the left action can be put into a background thread to fulfill the task.

The slow operations are mostly moved into background, this will let user feel much faster than before. Even if user closes the program, OpenOffice will wait until the background thread finished. So the data is safe.

The “content” could be modified during background saving, so we can get a model copy when start saving. Some other conditions like two save task conflict can be solved by other methods.

Save flow new.PNG

What About Auto Save

Auto save can be handled similar with above way, even the progress bar is unnecessary. User doesn't want to know when happens auto save.

Personal tools