This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Speeding up method searches


Bryce McKinlay <bryce@albatross.co.nz> writes:

> Now, if the compiler could sort the methods table alphanumerically, we
> should be able to get a huge speed increase in all these places by doing
> a simple binary search.

Or if the strings were guaranteed to be interned, then the comparsion
would be very cheap - just a single pointer equality test.

There is a tradeoff here: A binary search will use fewer comparisons
than a linear search on interned strings, but the cost of each
comparison is much cheaper in the latter case, since you don't need
to look at a single character.

> Would it be possible to implement this in the compiler? Or does the
> Class::methods table somehow depend on the vtable order of methods?

Not inherently at least, I think.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]