Being Java programmer.
Being Java programmer.
Ganish Patil wrote:Which one is better in performance ?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
about this I don't know how to check its performance in terms of memory, time, clock time etc because I'm just practicing simple code and not implementing any big application where I need to copy content of files in thousands and more, then and then only I can face the performance issue.In terms of memory, cpu cycles, clock time, disk I/O, a developer's time spent writing the code... there are many ways to measure "performance". Without you defining what EXACTLY matters, all anyone can do is guess
Being Java programmer.
Being Java programmer.
A big number! yes I'll definitely do that...1000000 files
Being Java programmer.
Being Java programmer.
Being Java programmer.
Being Java programmer.
Ganish Patil wrote: about this I don't know how to check its performance in terms of memory, time, clock time
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Being Java programmer.
Being Java programmer.
yes your correct, I didn't notice that & yes I should've closed reader.you are not doing it char by char, you are copying line by line.
oh that's why its writing on a line thank you anyway I should make this resolved as I moved ahead to learn JSP & Servlet. once again thank you Dave.those lines do not have the new line character in them
Being Java programmer.
What makes you think it is resolved?Ganish Patil wrote: . . . I should make this resolved . . .
as I was looking forWhat makes you think it is resolved?
then came to know performance meansWhich one is better in performance ?
but I didn't have any purpose at the beginning because I was just practicing and guessing as fred saidIn terms of memory, cpu cycles, clock time, disk I/O, a developer's time spent writing the code...there are many ways to measure "performance"
, then realized that I should know first what matters me, after knowing performance measurement ways then thought to measure performance in time, both takes to complete this task.there are many ways to measure "performance". Without you defining what EXACTLY matters, all anyone can do is guess
I don't think so because I didn't create target files in advance and used same source file in both ways. Both of them have to create target files with same attributes (If target files are not present then both creates them as in copying I first used which creates and copies to files then used which overwrites existing files & measured performance of both copying types in terms of time).Do you think the time to write depends on setting file attributes?
Being Java programmer.
perhaps, because if there is less space on hard drive then performance may differ.simply on finding suitable space on your hard drive for the writing
may be, difficult to find reading performance of copying in terms of time, we can find reading performance of read line by line in terms of time so not sure .is it the time spent reading
yes it varies from run to run. I think it also relies on your computer, if there is too much work loaddoes it vary from run to run
Being Java programmer.
Are those times actually different? I suspect 257 and 233 are not significantly different.Ganish Patil wrote: . . . then it took 257606 milliseconds.
. . . it took 233240 milliseconds.
In copying files:
. . . 463059 milliseconds.
. . . took 411114 milliseconds.
. . .
Being Java programmer.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |