The lifespan of a developer PC

How long does a developer machine last? Most of the time you will get an answer such as 2 or 3 years. A couple of years ago, this would be a perfectly reasonable answer. Now, I’m not so sure.  The reason for upgrading was always linked to newer software, which was pretty much always more demanding, while newer hardware was always much more capable than the 2-3 year old stuff you got.

Things have changed. Software hasn’t gotten much more demanding. In fact, sometimes it’s gotten more efficient. This has to do with the trend for everything to go mobile. Battery life becomes an important factor, while the amount of processing power available becomes less or stays the same, because more performance eats away at the battery. Instead of more performance, we get the same performance in a more energy efficient way.

The reason I started writing this, is that my PC is 6 years old, and I’m still using it everyday, even for coding.

These are the specs, it has become a sort of Franken – PC:

DSC_0052

Core2Quad. Click the image for a large version.

Silverstone Milo 3 case
Asus 350W PSU (about 10 years old)
Asus P5QL-CM s775 board
Intel Core2Quad Q8200 CPU
4GB PC800 DDR2 Memory
Geforce GT 730 2GB
WD Green 500GB HDD
Samsung 850 EVO 120GB SSD
LG  DVD burner

DSC_0053

Secret weapon: the Samsung SSD, which makes the system really quick.

A couple of months ago I added the SSD and new Graphics card. SSD’s are becoming a necessity these days and it is easily the biggest performance upgrade for a machine like this. The graphics card was because the onboard G43 chipset doesn’t have hardware support for HD video and modern codecs, its performance was    almost too low for normal desktop use.

The core of this machine (CPU, Motherboard, Memory and HDD)  is now 6 years old and still perfectly usable. Visual Studio 2013 starts in seconds and complex solutions can be loaded in a short amount of time. Of course, if you compare it to a current machine, it’s not nearly as fast. The question is, do you need that performance ? The speed is enough to support my work process, I never have to wait an unreasonable amount of time.DSC_0056

That said, some things just cannot be done with this machine. VM’s are out of the question, because there’s no VT-x support. VM’s are extremely slow and you quickly reach the ceiling of 4GB memory.

Ah, the memory. Next interesting point. I thought I would run out of memory quite quickly with the modern applications, especially because you tend to use more than one application at once.
At work, my machine contains 8GB and I regularly touch 6-7 GB memory in use. With this machine, it mostly stays under 3GB. I guess this has to with how modern OS’s and applications manage memory, caching as much as possible and delaying garbage collection. 4GB apparently is still enough for normal use without VM’s running etc.

DSC_0055

Asus 350W power supply. Click for larger image

Other drawbacks, especially when compared to notebooks is power consumption. The PSU is 10 years old, constructed in a time when power consumption and efficiency did not matter that much. I hooked up an energy meter and found out that the power consumption when powered off was 8 watts! This would be unthinkable now.  Normal power consumption is 60 Watts at idle, 110 Watts maximum. The monitor adds about 25 Watts.

It’s tempting to say that buying new would be more eco-friendly because new machines are a lot more efficient and consume less electricity.  However, I found this article: http://www.lowtechmagazine.com/2009/06/embodied-energy-of-digital-technology.html It describes, based on research done,  how energy intensive the manufacturing of a computer really is.  For a notebook that is used for 3 years, 80% of the energy consumption takes place during the manufacturing phase. That’s stunning and really convinced me that we should postpone upgrading for as long as possible. It also means that all the energy savings that come with new equipment would be offset by the huge energy consumption during production.

E-waste

E-waste

It’s important to realize that unlike in the past, PC’s do not become obsolete as fast anymore. With a few minor upgrades, systems can be used for a lot longer. It would save an enormous amount of energy and a big garbage pile if we used our systems for as long as possible and make the effort to do component upgrades instead of buying a completely new machine.

 

Posted in Other | Leave a comment

Entity FrameWork: Add vs AddRange

Say you want to create a bunch of objects and save them in a database.  You start writing a method that accepts an IEnumerable of the object and contains something like this:

public void InsertMembers(IEnumerable<Member> members)
{
ModelContainer container = new ModelContainer();

List<memberObject> sets = new List<memberObject>();
foreach (var member in members)
{
var modelSet = Mapper.Map<memberObject>(member);
modelSet.TempKey = 2;
modelSet.ID = “ID”;
sets.Add(modelSet);

….

 

Now it occurs to you that in order to append the objects to your context, you have 2 options: within the foreach loop, you can add

container.memberObject.Add(modelSet);

Or, you can create a generic list that you use to build a collection of your items and after the foreach loop, you add

container.memberObject.AddRange(sets);

Turns out the last option is A LOT faster. Apparently there is much overhead in adding a single new item to the context, so adding a collection at once is the way to go. If you have to add 1000s of rows to your database at once,  use AddRange. It makes a difference like night and day.

 

Posted in Coding | Leave a comment