Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » HashTableOf[X](Legacy code?)
HashTableOf[X] [message #1142043] Thu, 17 October 2013 07:10 Go to next message
Eclipse UserFriend
Hello Everyone,
I have been looking around the code in Eclipse source code and have come across something quite strange:
There seems to be a whole bunch of HashTableOf[X] classes in the org.eclipse.jdt.internal.compiler.util package. I am trying to figure out if the code would benefit by replacing them with a normal java.util.HashMap.
In particular I can't see any benefit of HashTableOfObject over HashMap - containsKey() in particular is O(N) rather then O(1). I suppose the primitive versions such as HashTableOfInt avoids boxing but I am not sure this was the thinking when they were created.

Another worrying thing is that they are located in the compiler.util package but they seem to be used all over the place (outside the scope of the compiler).

Any thoughts?
Re: HashTableOf[X] [message #1142360 is a reply to message #1142043] Thu, 17 October 2013 11:18 Go to previous messageGo to next message
Eclipse UserFriend
I haven't been around when those classes were introduced, but one obvious reason for these classes is:
JDT/Core is compiled at Java source level 1.3 and hence cannot use generics. Those classes provide a type-safe workaround.

As for performance, I *believe* that considerations have been made that a simpler implementation may actually perform better for small numbers of entries, but it may be well invested time to perform some measurements.

Concerning scoping: since the compiler is also packaged standalone, everything needed by the compiler must be defined in this module. The reverse direction doesn't have any such restrictions.

Thanks,
Stephan
Re: HashTableOf[X] [message #1142376 is a reply to message #1142360] Thu, 17 October 2013 11:30 Go to previous message
Eclipse UserFriend
Upon closer inspection it seems I misinterpreted the HashtableOfObject.containsKey() code. It is O(1).

I guess I should try and write some tests to see how the performance compares.
Previous Topic:Spell Checker for Eclipse Custom Editor
Next Topic:[SOLVED] Cannot run JUnit Plug-in Tests on Linux
Goto Forum:
  


Current Time: Wed Jul 16 04:16:00 EDT 2025

Powered by FUDForum. Page generated in 0.08093 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top