# \[Feedback\] Perspective view load-ahead optimization

**URL:** <https://forum.inductiveautomation.com/t/feedback-perspective-view-load-ahead-optimization/45309>\
**Category:** Ignition Early Access\
**Tags:** ignition81, perspective\
**Created:** [April 6, 2021, 7:52pm UTC](https://forum.inductiveautomation.com/t/feedback-perspective-view-load-ahead-optimization/45309 "2021-04-06T19:52:27Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 8, 2021, 12:17am UTC](https://forum.inductiveautomation.com/t/feedback-perspective-view-load-ahead-optimization/45309/7 "2021-04-08T00:17:35Z")

</div>

Hi Carl, sorry to be the bearer of bad news, but i’ve just tested this and it’s actually made our load times _worse_ and increased them by more than 2x.

I took 2 GIF screencaptures at 30fps (nominal, the app [[https://www.screentogif.com/](https://www.screentogif.com/)] I use I believe does some smarts to work out if frames have changed or not to discard duplicates) when loading the same screen with the load-ahead enabled and disabled. I cut these animations down to only the frames where the page was loading from start to end, and the results are below.  
Edit: I just added an additional two tests performed right on the server itself in Chrome.

What I found was that when the load-ahead option is enabled, the loading icon overlay ( ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/2/920437931887c311cd599fa426eb1a69ddac3fdd.png) ) actually displayed for approximately the time it took for the disabled option to _fully_ load the page (for one run, the loading icon overlay displayed for 2220ms, then the tag bindings took another 2740ms to load once the loading overlay disappeared).

```auto
Total frame time: (35, 4720) <-- 35 frames, 4720ms in total load time
File: Perspective 8.1.5 speed increase comparison - New TF FS - Active - TF Detail Only.gif

Total frame time: (35, 4960)
File: Perspective 8.1.5 speed increase comparison - New TF FS - Active - TF Detail Only 2.gif

Total frame time: (47, 6140)
File: Perspective 8.1.5 speed increase comparison - New TF FS - Server Client - Active - TF Detail Only 1.gif

Total frame time: (51, 6060)
File: Perspective 8.1.5 speed increase comparison - New TF FS - Server Client - Active - TF Detail Only 2.gif

Total frame time: (31, 2230)
File: Perspective 8.1.5 speed increase comparison - New TF FS - InActive - TF Detail Only.gif

Total frame time: (35, 2340)
File: Perspective 8.1.5 speed increase comparison - New TF FS - InActive - TF Detail Only 2.gif

Total frame time: (35, 2900)
File: Perspective 8.1.5 speed increase comparison - New TF FS - Server Client - InActive - TF Detail Only 1.gif

Total frame time: (39, 2750)
File: Perspective 8.1.5 speed increase comparison - New TF FS - Server Client - InActive - TF Detail Only 2.gif

```

This is the python code I used to calc the total frame times (stolen mostly from here [[Get frames per second of a gif in python? - Stack Overflow](https://stackoverflow.com/questions/53364769/get-frames-per-second-of-a-gif-in-python/53365469#53365469)]) For those wanting to actually use this, I had to install the ‘pillow’ library instead of the ‘PIL’ library, and I ran it in PyCharm with Python 3.9:

```auto
import os
from PIL import Image
import tkinter as tk
from tkinter import filedialog

def choose_file():
    root = tk.Tk()
    root.withdraw()
    file_path = filedialog.askopenfilename(filetypes=[('GIF', '*.gif')])
    return file_path

def get_frame_time(PIL_Image_object, startFrame=None, endFrame=None):
    """ Returns the total time of the of a PIL Image object """
    if startFrame is None:
        startFrame = 0
    if endFrame is None:
        endFrame = -1

    PIL_Image_object.seek(startFrame)
    nextFrame = 0
    frames = duration = 0
    while endFrame == -1 or nextFrame <= endFrame:
        try:
            frames += 1
            this_duration = PIL_Image_object.info['duration']
            duration += this_duration
            PIL_Image_object.seek(PIL_Image_object.tell() + 1)
            nextFrame = PIL_Image_object.tell()
        except EOFError:
            return frames, duration
    return frames, duration

def get_avg_fps(PIL_Image_object):
    """ Returns the average framerate of a PIL Image object """
    PIL_Image_object.seek(0)
    frames = duration = 0
    while True:
        try:
            frames += 1
            duration += PIL_Image_object.info['duration']
            PIL_Image_object.seek(PIL_Image_object.tell() + 1)
        except EOFError:
            return frames / duration * 1000
    return None

def main():
    filePath = choose_file()
    img_obj = Image.open(filePath)
    print(f"Total frame time: {get_frame_time(img_obj)}")
    print(f"File: {filePath.split('/')[-1]}")

if __name__ == ' __main__':
    main()

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/feedback-perspective-view-load-ahead-optimization/45309)._
