db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <to...@first.fhg.de>
Subject Re: PersistentField implementations, dramatic performance differences
Date Sat, 26 Jun 2004 09:32:47 GMT
Armin Waibel wrote:

> Your PC is too fast ;-)

Hmm, not that fast, only an Athlon 2600+.

> I think that the JVM has problems (bug) when
> System.currentTimeMillis()
> was called.
> It seems that under specific conditions this method returns the same 
> value more than one time although more than one ms is passed.
> Try this test on your machine
> 
> public void testA() throws Exception
> {
>     long result[] = new long[50];
>     for (int i = 0; i < result.length; i++)
>     {
>         result[i] = System.currentTimeMillis();
>         Thread.sleep(1);
>     }
> 
>     for (int i = 0; i < result.length; i++)
>     {
>         System.out.println("time: " + result[i]);
>     }
>     System.exit(0);
> }

That gives:

time: 1088242118296
time: 1088242118296
time: 1088242118296
time: 1088242118296
time: 1088242118296
time: 1088242118296
time: 1088242118312
time: 1088242118312
time: 1088242118312
time: 1088242118312
time: 1088242118312
time: 1088242118312
time: 1088242118312
time: 1088242118312
time: 1088242118328
time: 1088242118328
time: 1088242118328
time: 1088242118328
time: 1088242118328
time: 1088242118328
time: 1088242118328
time: 1088242118328
time: 1088242118343
time: 1088242118343
time: 1088242118343
time: 1088242118343
time: 1088242118343
time: 1088242118343
time: 1088242118343
time: 1088242118343
time: 1088242118359
time: 1088242118359
time: 1088242118359
time: 1088242118359
time: 1088242118359
time: 1088242118359
time: 1088242118359
time: 1088242118359
time: 1088242118375
time: 1088242118375
time: 1088242118375
time: 1088242118375
time: 1088242118375
time: 1088242118375
time: 1088242118375
time: 1088242118375
time: 1088242118390
time: 1088242118390
time: 1088242118390
time: 1088242118390

But as the doc for currentTimeMillis() states, this is not a bug in the 
JDK but depends on the machine used:

"Returns the current time in milliseconds. Note that while the unit of 
time of the return value is a millisecond, the granularity of the value 
depends on the underlying operating system and may be larger. For 
example, many operating systems measure time in units of tens of 
milliseconds."

> I added a test case for PersistenceFields (PersistenceFieldTest), it 
> seems that PersistenceFieldAutoProxyImpl isn't work properly. The test 
> does not pass.
> The test use non-nested, nested fields and fields specific to 
> Introspector (metadata name is compilant with javabeans, but class field 
> name differs).

I'll check that.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message