• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what am I missing?

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've already tested the file scanner which takes a few seconds to scan the whole file. This is stalling, just blinking the cursor while nothing happens...

 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not clear what you're asking. What do you expect the program to do that it's not doing?
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add some of System.out.println and to see where you stop.
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually the code was fine. it just took a lot longer to run than my test code. the cursor was blinking on an empty screen for so long that i thought it wasnt running right. i made it print out each set of tokens while it's running. now it's been running fine for over a minute, but it's still in the B's. thanks :roll:
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jesse,

1) I bet you've heard at least once that using StringBuffer (or the JDK 1.5 StringBuilder) is better than using String and the "+" operator. This program is absolutely one of those times. If you made tokenList into a StringBuffer (or StringBuilder) and used separate "append()" calls instead of each "+" operation, you'd have a noticeable speedup.

2) Another probably large performance improvement could be gotten with buffered I/O. Replace the Scanner allocation with

new Scanner(new BufferedReader(new FileReader("Websters_1913_Dictionary.txt")));

... and you should notice a large speedup.

3) Your signature is hella confusing -- I thought it was part of your question, originally, which really confused me, as I couldn't see where any of that output was supposed to come from. I'd change it if I were you!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic