Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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

Back to the top