Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] profiling stuff..

no didnt help

The hotspot just moved to a different location:

LocalEnvironmentProvider.getProjectEnvironment(IProject project)

do we really need to do exists() there? because project.isAccessible() already says that it has a resource and that exists
or do you really have to know that it is a file?

if i make from this:

        if (project.isAccessible()) {
            IPath location = project.getLocation();
            if (location != null) {
                File file = new File(location.makeAbsolute().toOSString());
                if (file.exists()) {
                    return LocalEnvironment.getInstance();
                }
            }
        }
        return null;

this:

        if (project.isAccessible()) {
                    return LocalEnvironment.getInstance();
        }
        return null;

it is about 10 times faster, the hotspot of 3.2 seconds i gone.
I guess this is the wrong fix. But somehow we need to cache that or dont call that code that often.

johan


On Thu, May 29, 2008 at 4:49 PM, Andrei Sobolev <andrei.sobolev@xxxxxxxxx> wrote:
Hi Johan,

I've updated this stuff today.
It should work without slowdown now.
I've committed this code to HEAD in about 3 hours ago. So please update.

Best regards,
Andrei Sobolev.

----- Original Message -----
From: "Johan Compagner" <jcompagner@xxxxxxxxx>
To: "DLTK Developer list" <dltk-dev@xxxxxxxxxxx>
Sent: Thursday, May 29, 2008 9:30:25 PM GMT +06:00 Almaty, Novosibirsk
Subject: [Dltk-dev] profiling stuff..


Hi,

I am profiling some stuff because saving bit _javascript_ files are really slow for us
Now i am seeing for example this as a hotspot:

LocalEnvironment:

public boolean hasProject(IProject project) {
if (project.isAccessible()) {
IPath location = project.getLocation();
if (location != null) {
File file = new File(location.makeAbsolute().toOSString());
if (file.exists()) {
return true;
}
}
}
return false;
}

and then the file.exists() call.

This is by itself not really slow of course
But by parsing the JS files many ModelElements (subclasses) are created
and that has an equal method:

public boolean equals(Object o) {

if (this == o)
return true;

IEnvironment environment = EnvironmentManager.getEnvironment(this);
if (o instanceof IModelElement && environment != null) {
IEnvironment environmento = EnvironmentManager
.getEnvironment((IModelElement) o);
if (!environment.equals(environmento)) {
return false;
}
}

that is called a lot.. so that getEnviroment() is hit many many times.

If for example i quickly do in hasProject() just return true..
Then i gain 3 seconds! for 1 save of a js file.

But i dont know where to do stuff. Where can we cache stuff or do we really need that exists() call

johan

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top