My lab partner and I programmed a DENSO robotic arm to stack plastic cups for our last Robotic Manipulation lab. Look it go!
Robot Arm Stacking Cups
Reply
My lab partner and I programmed a DENSO robotic arm to stack plastic cups for our last Robotic Manipulation lab. Look it go!
In the spirit of science and experimentation, I compared the performance of Scala’s immutable HashMap against it’s mutable cousin. I also compared it to Java’s HashMap just for kicks.
The code I used to run this performance comparison is below. It’s a standalone program that accepts two arguments: (1) the number of elements to insert in each trial and (2) the number of trials to run.
Here are the results of inserting 1,000,000 elements per trial and 10 trials on a MacBook Pro with a 2.53 GHz Core 2 Duo and 4 GB RAM.
This is a performance test comparing java.util.HashMap, scala.collection.immutable.HashMap, and scala.collection.mutable.HashMap. The test inserts 1000000 elements into each map. Testing Scala Immutable HashMap 6.927 6.941 7.076 7.076 7.068 6.89 6.74 6.709 6.959 7.158 ---------- Mean: 6.9300000000000015 Testing Scala Mutable HashMap 2.623 2.549 2.566 2.53 2.546 2.558 2.485 2.658 2.545 2.534 ---------- Mean: 2.5760999999999994 Testing Java HashMap 1.729 1.766 1.696 1.683 1.741 1.809 1.755 1.738 1.734 1.775 ---------- Mean: 1.8318000000000005
I think it’s pretty clear that while immutable data structures are pretty nice, they come at a huge performance cost.