Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HashTable or FileReaders (writing own javaEditor)

 
vishwas bhatt
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Everyone!
I am wrinting my own java editor using java.
which can recognize keywords and basic classes and give them apropriate Color while typing.
I am using HashTable for storing keyword,classes and there relevent Color values.more then 150 listing in singel HashTable and speed is too slow.
instead of using HashTable now i want to use FileReaders i want to put keywords and class names in different files. will it increase the speed of recognizing the keywords. if not then pls suggest me some proper way of doing all this.
 
Steve Deadsea
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a tutorial on how to write a text editor with syntax highlighting:
http://ostermiller.org/syntax/editor.html
 
vishwas bhatt
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Steve ,
I got read your tutorial but unable to download.
because proxy is giving error.
just tell meone thing will ur editor color word at the time of tying or after saving.
i want to use FileReader instead of HashTable suggest me.
 
Steve Deadsea
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tutorial outlines proceedures that need to be followed to color text dynamically (and quickly) as the user types.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vishwas bhatt:

I am using HashTable for storing keyword,classes and there relevent Color values.more then 150 listing in singel HashTable and speed is too slow.

Are you really sure it is the *HashTable* that is to slow? Did you profile your program?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm with Ilja. HashTables are pretty darn fast usually, and 150 entries is not a large number. There are many other things that could be wrong here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic