Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Just another dumb microbenchmark Vector vs. ArrayList  (Read 1208 times)
0 Members and 1 Guest are viewing this topic.
Offline Linuxhippy

Senior Member


Medals: 1


Java games rock!


« Posted 2005-08-11 01:17:48 »

If you think to hear something new ... don't wast your time reading this post ;-)

Just because I was interrested I tried the well-known ArrayLIst vs. Vector on a 4-way Power5 machine and it turned out that all the guys claming Vector is faster are fooled by the different resizing characteristics.
It did not more than adding 20.000.000 times the same string object to an initialized collection.

The Collections were created on own Thread so absolutly no contended locking:

Vector:
1 Thread:    2302ms/calculation
10 Threads 2151ms/calculation
50 Threads 2127ms/calc

ArrayList:
1 Thread:      2034ms/calc
10 Threads:  646ms/calc
50 Threads:  524ms/calc

as you can see, arraylist scales well with the number of processors, vector does not even scale a bit although no contended locks should appear. Another scaliability problem I found is Memory-Management which seems to scale not at all, too ... however the test was run on an IBM-JVM so I cannot speak about hotspots parallel GCs.

lg Clemens
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2005-08-11 01:26:37 »

Just because I was interrested I tried the well-known ArrayLIst vs. Vector on a 4-way Power5 machine and it turned out that all the guys claming Vector is faster are fooled by the different resizing characteristics.
Odd, I've never heard of Vector being suggested as faster than ArrayList. Given that ArrayList isn't syncronised it should be the faster one, where did you come across this particular snippit of 'wisdom'?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Linuxhippy

Senior Member


Medals: 1


Java games rock!


« Reply #2 - Posted 2005-08-29 20:41:43 »

Odd, I've never heard of Vector being suggested as faster than ArrayList. Given that ArrayList isn't syncronised it should be the faster one, where did you come across this particular snippit of 'wisdom'?

Well this is a quite general misunderstatement - since as far as I know ArrayList has different resizing charakteristis (more memory friedly).

Quote
My understanding of the history of Vector:
Vector was in the 1.0 libraries
By the time of 1.2 ArrayList had come along and people were switching to it for better performance. Vector was synchronised and because of that slower than the unsynchronised ArrayList.
By the time of 1.4 however the synchronisation mechanism was much much better - and Vector actually had a slight performance advantage over ArrayList.
If you're just repeating the old 1.2 mantra I recommend doing some performance testing with large Vectors and ArrayLists - and if you get roughly the same performance then you should switch to Vector because of its thread safety. (Advice I should take myself)

and of course many more unprofesisonal statements spread all over the web. However too tired fir searching them ;-)

lg Clemens
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

E.R. Fleming (8 views)
2014-07-29 03:07:13

E.R. Fleming (4 views)
2014-07-29 03:06:25

pw (38 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!