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

perf: improve the query speed #5

Open
@pythonbrad

Description

@pythonbrad

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 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions