Optimization - first name vs last name

JasonMark
Thu, 25 Jan 2024 14:50:45 +0000
Floating Topics

Inspired by H0nza's annual optimization email, I'm diving back into optimization for one of my projects. I created a loop that goes to 10 records, and found one change that brings the time to visit 10 records from around 36 seconds to around 9 seconds.

UPDATE: I had a conditional formatting on those fields. It wasn't the "hide object when" that was causing the problem. Removing the conditional formatting speeds it up drastically. SIDE NOTE: If EITHER of these fields had conditional formatting the time was super long.

NOTES BELOW LEFT IN FOR ARCHIVAL PURPOSES but incorrect:

Staff can search for students. About half the staff members sort students by first name and about half sort them by last name. You can see my layout below (names blocked out for privacy).

I have two indexed text fields (not calculations) which are

CombinedNameFirstLast and CombinedNameLastFirst

When users log in I set a global variable based on their preference of sort order and then in the portal on the lefthand side I put both cached fields and to show the correct one I use:

Hide Object When: $$SortOrder = "Last"
and
Hide Object When: $$SortOrder = "First"

to show the correct one. When I remove these two hide statements the entire screen speeds by 75%! Things I've tried that didn't have noticeable effect:

Making two portals and putting the hide on the entire portal (not faster)

Setting a GlobalField instead of $$GlobalVariable for sort order (slower)

Using that GlobalField to join to a new table which stores every students name and show the correct related field (slower)

One option would be for me to have two different layouts, but this actually affects half a dozen layouts, so I'd need to make another half a dozen layouts and going forward every change I make would have to be made to two layouts.

I'd have to go and find every script that goes to this layout and put a hook in the script, which won't be that hard with 2empowerFM search tool, and it might be worth it, but I'm wondering if anyone has any other ideas that they might be able to suggest.

3 posts - 2 participants