"Best practices" with images for optimal performance.

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms "Best practices" with images for optimal performance.

Viewing 3 reply threads
  • Author
    Posts
  • September 15, 2016 at 11:13 PM #19567

    Frances Cherman
    Participant

    With my TapForms database at a modest 589MB (compacted), on my PowerBook with 8GB RAM and only TapForms, Chrome (with about 40 tabs), and Activity Monitor running, deleting a single field currently involves watching the beach ball spin for several minutes (2 or 3 5 minutes at least, which is way too long, during which my Mac indicates the app is “not responding”). Changing from the default layout to another layout also causes the beach ball to spin. I only have 165 records, and most of them haven’t even been populated yet. Among the ones that have been populated, however, some have 5 to 8 images in a single image field, as well as multiple images pasted into note fields. I’ve experimented with changing the view (hiding the multi-column view, for example) before I delete a field, and that didn’t seem to make any difference in speed. So I some questions about “best practices” for optimizing performance:

    1. Which is the more “expensive” method (performance-wise) for storing images: image fields or notes? In my case, I can use either. Notes have several advantages, such as being able to annotate and explain images. The drawback of Notes is that the field grows (in the default view) to accommodate the entire note, which makes for a lot of scrolling. But if it would result in a smaller file and faster performance, I’ll deal with it.
    2. Is the quality of images pasted in notes is the same as those stored in image fields? Eventually, I will be copying and pasting those images into a Word document, and they need to look decent.
    3. Which view – multi-column or single-column – has the biggest impact on performance?
    4. Are there any other things (views, number of layouts,, calculations, etc.) that impact performance? What do you recommend to reduce overhead?

    Thanks for your guidance, as always.

    September 15, 2016 at 11:33 PM #19570

    Brendan
    Keymaster

    Hi Frances,

    1. Putting images in Note fields is definitely way slower than having regular Photo fields. I would use that only for tiny images, not for full scale images. A Note field can contain rich text, including as you know, images. That value is what’s called an NSMutableAttributedString. When saved to the database, it has to first be archived to be converted to an NSData object (basically just a big binary). Then it has to be converted to text using a Base 64 encoding algorithm. Then it’s stored along side all the other values. There is a huge impact on performance when doing this. Photos are stored as files on disk will very little data stored in the database. Just a bit of metadata so that Tap Forms knows you’re referencing the images on disk. So try to avoid putting images in Notes if you can.
    2. I don’t do any scaling or manipulation of the images themselves when pasted into a Note field. But the Note field does have to scale the images to get them to fit into the physical space, so that can cause a performance bottleneck too.
    3. Single column view would generally be quicker than multi-column view because multi-column view has to render more data on screen at once than single-column view.
    4. The Photo Grid View is very quick for displaying image thumbnails. Custom layouts don’t get rendered until you click on them, so the number of layouts has no impact on performance. But the more things you have on the layout, the more time Tap Forms will take to render all the things. A Calculation field that references other calculation fields will be slower than just embedding the other formula into the formula of the Calculation field you’re working with. I recommend not putting images into Note fields to improve performance.
    September 16, 2016 at 2:08 PM #19574

    Frances Cherman
    Participant

    This is exactly the type of information I was looking for. Thanks!

    September 19, 2016 at 10:22 PM #19652

    Frances Cherman
    Participant

    Just a follow-up in case anyone else runs into this issue, since I do need to be able to combine images and text, and since Brendan said that large images in the Notes field could be the source of my slowdown, I moved all of my image-laden notes into TextEdit files outside the database, and linked them as file attachments to the appropriate records. This somewhat defeats the main benefit of the Notes field for me (it would be great if I could preview the files from the attachment field), but it has definitely made a huge difference in performance. I am still using the Notes field to paste text from Web pages in its original format, and that doesn’t seem to bog down the app.

Viewing 3 reply threads

You must be logged in to reply to this topic.