Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Re: Improving index for global functions

Hi Michael,

1) Now there was single test failure in RubyFullNameSearchTests.
It could be fixed with the following change in SearchPattern.createMethodOrConstructorPattern:

if (findDeclarations) {
	final char[][] packageNames;
	if (declaringTypeQualification != null) {
		packageNames = CharOperation.splitOn(processor
			.getDelimiterReplacementString().toCharArray(),
			declaringTypeQualification);
	} else {
		packageNames = CharOperation.NO_CHAR_CHAR;
	}
	int enclosingTypeCount = packageNames.length;
	if (declaringTypeSimpleName != null) {
		++enclosingTypeCount;
	}
	final char[][] enclosingTypes;
	if (enclosingTypeCount != 0) {
		enclosingTypes = new char[enclosingTypeCount][];
		System.arraycopy(packageNames, 0, enclosingTypes, 0,
				packageNames.length);
		if (declaringTypeSimpleName != null) {
			enclosingTypes[enclosingTypeCount - 1] = declaringTypeSimpleName;
		}
	} else {
		enclosingTypes = null;
	}
	return new MethodDeclarationPattern(enclosingTypes,
			selectorChars, matchRule, toolkit);
}

2) It probably make sense to extract:

static PackageNameSet internedPackageNames
static class PackageNameSet

and use them in both MethodDeclarationPattern and TypeDeclarationPattern.

3) In MethodDeclarationPattern.matchesDecodedKey(SearchPattern)

Why is it required to compare pkg? I could not find any place where pkg is initialized.

I think second check should be something like the following:

if (enclosingTypeNames != null) {
	if (pattern.enclosingTypeNames == null
			|| pattern.enclosingTypeNames.length == 0
			|| !matchesName(
					enclosingTypeNames[enclosingTypeNames.length - 1],
					pattern.enclosingTypeNames[pattern.enclosingTypeNames.length - 1])) {
		return false;
	}
}

So it would slightly optimize search for type + method pairs.

I don't see other issues, so 
+1 (with my suggestions :-)

Regards,
Alex

----- Original Message -----
From: "Michael Spector" <spektom@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Monday, April 6, 2009 9:02:35 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] Re: Improving index for global functions

Hi Alex,

Are there any news? We hope to add this patch before M7.

Thanks.

On Sun, Apr 5, 2009 at 4:07 PM, Michael Spector <spektom@xxxxxxxxx> wrote:
> Hi Alex,
>
> Indeed, the work was incomplete. Thank you for pointing me out to the tests.
> I've attached a new patch to the bug
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=270808).
>
> Thanks!
>
> On Thu, Apr 2, 2009 at 9:50 PM, Alex Panchenko <alex@xxxxxxxxx> wrote:
>> Hi Michael,
>>
>> We have 5 test failures in org.eclipse.dltk.tcl.core.tests.model.SearchTests. For example, one of them (testMethod002) is search for method declarations with pattern "a*::alfa".
>>
>> So, some exotic patterns need more debugging, I hope to look into these tests tomorrow.
>>
>> Regards,
>> Alex
>>
>> ----- Original Message -----
>> From: "Alex Panchenko" <alex@xxxxxxxxx>
>> To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
>> Sent: Thursday, April 2, 2009 8:27:33 PM GMT +06:00 Almaty, Novosibirsk
>> Subject: Re: [Dltk-dev] Re: Improving index for global functions
>>
>> Hi Michael,
>>
>> I have started to look at it, but have not finished yet, so I am going to continue with it tonight.
>>
>> Regards,
>> Alex
>>
>> ----- Original Message -----
>> From: "Michael Spector" <spektom@xxxxxxxxx>
>> To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
>> Sent: Thursday, April 2, 2009 8:10:46 PM GMT +06:00 Almaty, Novosibirsk
>> Subject: [Dltk-dev] Re: Improving index for global functions
>>
>> Anybody has a chance re-viewing the patch?
>> Or the silence means: there are no objections? :)
>>
>> Thanks,
>>
>> On Wed, Apr 1, 2009 at 6:10 PM, Michael Spector <spektom@xxxxxxxxx> wrote:
>>> Hi All,
>>>
>>> Please see the following bug:
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=270808
>>> I've proposed a patch to this bug (see attachment in the bug). I would
>>> like to commit it, can someone review?
>>>
>>> Thanks!
>>>
>>> --
>>> Best regards,
>>> Michael
>>>
>>
>>
>>
>> --
>> Best regards,
>> Michael
>> _______________________________________________
>> 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
>>
>
>
>
> --
> Best regards,
> Michael
>



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


Back to the top