Current Forum: 15-211 Main Forum |
Date: Sun Sep 30 2001 4:52 pm |
Author: Sakr, Hisham A. <hsakr@andrew.cmu.edu> |
Subject: System.out.println == slow? |
|
|
It just occurred to me that doing System.out.println might be using up a little bit too much of precious cpu time, so I tried commenting out the bit where it displays all the words that it inserts in the trie. All of a sudden the trie processing time on my machine went from like 1 minute down to 4 seconds, and on the unix machines it went from 29 to 6.5 secs. I guess this also explains why my code for the last homework was unusally slow as well (I had it print out a lot of stuff). My question: is there any simple reason why doing this one simple little command takes so much cpu time compared to the rest of my code? Or is it some really complex low level OS related type of thing that I wont understand? |
|