Skip to content

Extremely bad performance on version 2.2 #263

@nWidart

Description

@nWidart

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions