Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

perf: improve the query speed #5

Open
pythonbrad opened this issue Mar 5, 2022 · 0 comments
Open

perf: improve the query speed #5

pythonbrad opened this issue Mar 5, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@pythonbrad
Copy link
Owner

pythonbrad commented Mar 5, 2022

We need to improve the speed of the query via our ORM. By example:

  • limit the number of for loop to verify that a quiz is valid (contains questions and each question contains answers)

Bad performance

$questions = $quiz->questions;

if (count($questions) == 0) {
    # invalid
}

foreach ($questions as $question) {
    if (count($question->answers) == 0) {
        # invalid
    }
}

Why?

$quiz->questions and $question->answers use a loop to get the data to return.
Then we have too much iterations.

NB:

For a longtime improvement, consider the issue #1 .

@pythonbrad pythonbrad added the enhancement New feature or request label Mar 5, 2022
@pythonbrad pythonbrad self-assigned this Mar 11, 2022
@pythonbrad pythonbrad removed their assignment Jan 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant