puzzled by different speeds...

hi,

i have a class called 'ClaimsZipper' that zips chunks of data into a file in proper

format.

I use this in another class that determines what to zip into the file.

the problem is, when i run ClaimsZipper by itself (meaning i use the main()

function and instantiate a ClaimsZipper object inside there) I call the

writeToFile(byte claim[]);

function. I ran a Profiler on it and found that each call is taking about .032

seconds. Not bad.

However, when I run this class inside the other class I see in the Profiler that it

is taking about .1 seconds, which is 3 times slower!

does anyone know why this might be? why would calling a class inside of

another class cause the former to slow down?

does calling it from inside the class have NOTHING to do with its speed?

thanks!

[871 byte] By [pnandrusa] at [2007-10-2 10:48:06]
# 1

Maybe when run with the other class, there are other things going on, such as garbage collection taking care of things that your simple test doesn't cause to need taking care of.

The method itself should still be taking the same amount of time, given the same input. It has nothing to do with being invoked from some other class.

warnerjaa at 2007-7-13 3:04:01 > top of Java-index,Java Essentials,Java Programming...
# 2
> The method itself should still be taking the same> amount of time, given the same input. It has nothing> to do with being invoked from some other class.that's what i thought. thanks
pnandrusa at 2007-7-13 3:04:01 > top of Java-index,Java Essentials,Java Programming...