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

Improve performance of midgard_storage methods #144

Open
flack opened this issue Feb 20, 2012 · 2 comments
Open

Improve performance of midgard_storage methods #144

flack opened this issue Feb 20, 2012 · 2 comments
Assignees
Milestone

Comments

@flack
Copy link
Member

flack commented Feb 20, 2012

When I run this code

$re = new ReflectionExtension('midgard2');
$classes = $re->getClasses();
$counter = 0;
$start = microtime(true);
foreach ($classes as $refclass)
{
    if (!$refclass->isSubclassOf('midgard_object'))
    {
        continue;
    }
    $type = $refclass->getName();
    if (midgard_storage::class_storage_exists($type))
    {
        $counter++;
    }
}
echo "found " . $counter . " schema types in " . round(microtime(true) - $start, 2) . "s";

I get the following output:

found 85 schema types in 154,82s

This is on a quad-core Xeon machine with 5GB of RAM, so I don't think it's a hardware thing. Either midgard_storage or the reflection calls must be really slow. It would be nice if this could be improved, for developing, this gets quite tiresome.

@piotras
Copy link
Member

piotras commented Feb 21, 2012

Known problem :( Libgda is bottleneck here. It uses own database to provide tables metadata IIRC.

@flack
Copy link
Member Author

flack commented Feb 24, 2012

But still, two seconds to check if a table exists is really a lot of time, it almost sounds as if it creates the metadata database on the fly for each method call. I wonder if some of the work it does couldn't be avoided somehow. BTW: If I call midgard_storage::class_storage_exists() twice per type in the loop, the runtime practically doubles (151s vs. 295s)

piotras added a commit to piotras/midgard-core that referenced this issue Feb 24, 2012
piotras added a commit to piotras/midgard-core that referenced this issue Mar 7, 2012
@ghost ghost assigned piotras Mar 14, 2012
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

2 participants