Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: defer instantiation of Validation in Model #8087

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Oct 24, 2023

Description
Closes #7935

  • defer instantiation of Validation in Model

Memory Usage:

before: 17392
 after:  7216
<?php

namespace App\Controllers;

use CodeIgniter\Model;

class Home extends BaseController
{
    public function index(): string
    {
        $before = memory_get_usage();
        $model = new Model();
        $after = memory_get_usage();

        return $after - $before;
    }
}

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added refactor Pull requests that refactor code 4.5 labels Oct 24, 2023
system/BaseModel.php Outdated Show resolved Hide resolved
@kenjis kenjis force-pushed the perf-model-defer-validation branch from 20bee81 to e8536c3 Compare October 25, 2023 02:13
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice

@kenjis kenjis merged commit bfd7719 into codeigniter4:4.5 Oct 26, 2023
45 checks passed
@kenjis kenjis deleted the perf-model-defer-validation branch October 26, 2023 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.5 refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants