Skip to content

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
@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
@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

refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants