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

Extremely bad performance on version 2.2 #263

Open
nWidart opened this issue Jun 22, 2016 · 0 comments
Open

Extremely bad performance on version 2.2 #263

nWidart opened this issue Jun 22, 2016 · 0 comments

Comments

@nWidart
Copy link
Member

nWidart commented Jun 22, 2016

I'm in the process of upgrading to laravel 5.2, using version 2.2 of this package.

However since this upgrade, the application load time has increased by almost 2 seconds.

I've run a blackfire.io profiler, this is what it looks like: https://blackfire.io/profiles/1fa3c08e-c1df-4c3d-84e2-ea73be40361c/graph

On that profile there are 606 calls to file_get_contents which comes from the Json class. This is with caching enabled. Without caching this was close to 1300 calls!

I think this could still be reduced as the same module.json file is called multiple times. The following image only shows a very small amount of calls.
screen shot 2016-06-22 at 17 29 36

Adding some caching to the getAttributs method in the Json class.

public function getAttributes()
{
    return app('cache')->remember($this->getPath(), 10, function () {
        return json_decode($this->getContents(), 1);
    });
}

This reduces the amount of calls to 22!!
After this change:
https://blackfire.io/profiles/8e098e83-af3c-4638-b6f5-3ffca7136f44/graph

I think this is something that should be looked at asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant