lookit / lookit/lookit-api

Studies view can take a long time to load.

Open
#1,256 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12
Forks
21
Avg merge
5d 19h
Merged PRs (30d)
5

Description

Description
The study view /exp/studies/<int:pk>/ is slow to load.

How to reproduce
Head to any to studies view and check the page load time.

Screenshot 2023-08-24 at 10 41 21 AM

Expected behavior
Generally, we'd want pages to load faster. Anything quicker is great, but something under 500ms would be amazing.

Additional context
I've tracked down the issue with two parts of this view's context:

  1. The function self.request.user.perms_for_study(study) seems to take a fairly time. The permissions accumulation from lab to studies seems unnecessary. The solution might be to get the permission you need instead of getting all the permissions.
  2. The self.search_researchers() function (and its brother function self.get_annotated_study_researchers()) can take a long time if the lab a many members. e.g. the Sandbox lab on staging. This might be best resolved loading this part of the page asynchronously.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the /exp/studies/<int:pk>/ study view and profile the perms_for_study(study), search_researchers(), and get_annotated_study_researchers() paths identified in the issue. Compare their contribution to page-load time, then verify that the study view loads substantially faster, with under 500ms as the stated target.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.