As an aside (and up front before the other numbers), I cleaned up some
code around the MetaData area so that ArrayLists were trimmed and the
other methods getUniqueChild, etc called my new getChildArrayByTagName
method. I also finalized methods in this area and Containers and took out
variable declarations within loops in these areas. The results were: RT:
115 ms (no change), min. 30 ms, max 3405 ms, VSZ: 183516Kb (down 0.37%),
RSS: 106756Kb (down 17.57%). I probably gave up any performance gains for
cleaning memory on the spot. It was interesting the in-memory use dropped
that much. But IBM take the opposite view - sacrifice memory for speed.

As to your question Bela, Trove actually provides benchmarks - the
creators want to make sure they are creating tight implementations. So out
of the box, you can run your own numbers. I'll work my way around to
concurrency issues once I'm satisfied with how things work in the current
set up. But looking at the JBoss code at the moment, if it doesn't have
concurrency issues now, I don't think the Trove classes will have much of
an impact here.

On my Win2K, PIII 1.2GHz with Sun JDK:
--------------------------------
java.vm.name=Java HotSpot(TM) Client VM
java.runtime.version=1.4.1_01-b01
os.name=Windows 2000
os.arch=x86
os.version=5.0
--------------------------------
compares 100000 Set.contains() operations. 3 are actually present in set
Iterations: 10
Their total (msec): 380
Our total (msec): 771
Their average (msec): 38
Our average (msec): 77
--------------------------------
sums a 100000 element Set of Integer objects.  Their approach uses
Iterator.hasN
ext()/next(); ours uses THashSet.forEach(TObjectProcedure)
Iterations: 10
Their total (msec): 380
Our total (msec): 130
Their average (msec): 38
Our average (msec): 13
--------------------------------
compares Iterator.hasNext()/ Iterator.next() over 100000 keys
Iterations: 10
Their total (msec): 270
Our total (msec): 151
Their average (msec): 27
Our average (msec): 15
compares Iterator.next() over 100000 map keys
Iterations: 10
Their total (msec): 241
Our total (msec): 90
Their average (msec): 24
Our average (msec): 9
--------------------------------
compares 100000 LinkedList.add() operations
Iterations: 10
Their total (msec): 851
Our total (msec): 190
Their average (msec): 85
Our average (msec): 19
--------------------------------
100000 entry primitive int map.put timing run; no basis for compariso
Iterations: 10
Their total (msec): 0
Our total (msec): 311
Their average (msec): 0
Our average (msec): 31
--------------------------------
compares 100000 Map.put() operations
Iterations: 10
Their total (msec): 2173
Our total (msec): 451
Their average (msec): 217
Our average (msec): 45
--------------------------------
compares 20000 Set.contains() operations
Iterations: 10
Their total (msec): 130
Our total (msec): 70
Their average (msec): 13
Our average (msec): 7
--------------------------------
compares 100000 Map.get() operations
Iterations: 10
Their total (msec): 470
Our total (msec): 371
Their average (msec): 47
Our average (msec): 37
--------------------------------
compares 100000 Set.add() operations
Iterations: 10
Their total (msec): 1843
Our total (msec): 350
Their average (msec): 184
Our average (msec): 35
--------------------------------
done

--------------------------
Compare size of Set implementation: 1,000 Integer objects measured in
bytes
javasoft: 48263
trove: 28856
trove's collection requires 59% of the memory needed by javasoft's
collection
--------------------------
Compare size of LinkedList implementation: 1,000 TLinkableAdaptor objects
measur
ed in bytes
javasoft: 40048
trove: 16024
trove's collection requires 40% of the memory needed by javasoft's
collection
--------------------------
Compare size of int/IntegerArrayList implementation: 1,000 ints measured
in byte
s
javasoft: 20040
trove: 4032
trove's collection requires 20% of the memory needed by javasoft's
collection
--------------------------
Compare size of Map implementation: 1,000 Integer->Integer mappings
measured in
bytes
javasoft: 48248
trove: 41688
trove's collection requires 86% of the memory needed by javasoft's
collection

**************************************************************************
*****

On Linux RedHat 7.2, PII 500MHz with IBM SDK:
--------------------------------
java.vm.name=Classic VM
java.runtime.version=1.4.0
os.name=Linux
os.arch=x86
os.version=2.4.18
--------------------------------
compares 100000 Set.contains() operations. 3 are actually present in set
Iterations: 10
Their total (msec): 934
Our total (msec): 1989
Their average (msec): 93
Our average (msec): 198
--------------------------------
sums a 100000 element Set of Integer objects.  Their approach uses
Iterator.hasNext()/next(); ours uses THashSet.forEach(TObjectProcedure)
Iterations: 10
Their total (msec): 705
Our total (msec): 227
Their average (msec): 70
Our average (msec): 22
--------------------------------
compares Iterator.hasNext()/ Iterator.next() over 100000 keys
Iterations: 10
Their total (msec): 508
Our total (msec): 470
Their average (msec): 50
Our average (msec): 47
--------------------------------
compares Iterator.next() over 100000 map keys
Iterations: 10
Their total (msec): 471
Our total (msec): 266
Their average (msec): 47
Our average (msec): 26
--------------------------------
compares 100000 LinkedList.add() operations
Iterations: 10
Their total (msec): 796
Our total (msec): 626
Their average (msec): 79
Our average (msec): 62
--------------------------------
100000 entry primitive int map.put timing run; no basis for comparison
Iterations: 10
Their total (msec): 0
Our total (msec): 678
Their average (msec): 0
Our average (msec): 67
--------------------------------
compares 100000 Map.put() operations
Iterations: 10
Their total (msec): 2321
Our total (msec): 911
Their average (msec): 232
Our average (msec): 91
--------------------------------
compares 20000 Set.contains() operations
Iterations: 10
Their total (msec): 274
Our total (msec): 224
Their average (msec): 27
Our average (msec): 22
--------------------------------
compares 100000 Map.get() operations
Iterations: 10
Their total (msec): 734
Our total (msec): 779
Their average (msec): 73
Our average (msec): 77
--------------------------------
compares 100000 Set.add() operations
Iterations: 10
Their total (msec): 2233
Our total (msec): 706
Their average (msec): 223
Our average (msec): 70
--------------------------------
done

--------------------------
Compare size of Set implementation: 1,000 Integer objects measured in
bytes
javasoft: 56217
trove: 25662
trove's collection requires 45% of the memory needed by javasoft's
collection
--------------------------
Compare size of LinkedList implementation: 1,000 TLinkableAdaptor objects
measured in bytes
javasoft: 44778
trove: 20759
trove's collection requires 46% of the memory needed by javasoft's
collection
--------------------------
Compare size of int/IntegerArrayList implementation: 1,000 ints measured
in bytes
javasoft: 18445
trove: 3438
trove's collection requires 18% of the memory needed by javasoft's
collection
--------------------------
Compare size of Map implementation: 1,000 Integer->Integer mappings
measured in bytes
javasoft: 54275
trove: 38409
trove's collection requires 70% of the memory needed by javasoft's
collection

As with any tests, you need to draw your own conclusions.

JonB

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Bela Ban
> Sent: Tuesday, 1 July 2003 4:34 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] On the performance trail - again
>
>
> Jon,
>
> do you have any numbers on this ? E.g. Sun's collection classes against
> Trove ?
>
> Performance is a moving target; ie. in one release of the VM, object
> creation kills you, and in the next it is gone (JDK 1.4). Or try-catch
> is bad, then in 1.4. the overhead is gone too.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to