Archive for December, 2007

How Assembler Can Save The Planet …

Friday, December 21st, 2007

Unless you are not from Earth then I would be amazed if you haven’t heard about several global warming and carbon this and carbon that discussions and I was thinking, could assembler save the planet?

I write Java most of the time and it is suitable for what I use it for and the performance appears good. However, the other day I was looking back at some of the assembler I have written and running it and example programs from the MASM forum and the speed of these programs blew me away. I have a very fast CPU (Intel Core 2 Duo (E6850)) but this is the same CPU that I run most of my Java tools and programs on during development. The speed difference is so noticeable that I looked closer.

The tests and analysis was rough and ready and therefore I wont be publishing results, since that isn’t really the point of this rant. The point is that we no longer try to get every last drop of performance out of the CPU’s we have because it is now cheaper to add another machine or buy another CPU than it is to optimize the code. This appears to me as the same consumerism and resource squandering that has put the planet into the problems it is in now.

If we write programs to be super fast and do more with less CPU cycles, then we need less cooling and less power and therefore less of the things that cause global warming. The best way that I know to get the most out of a CPU is to use Assembler and get as close to the metal as possible.

So Assembler CAN save the planet !!

Business software is Messy and Ugly …

Friday, December 14th, 2007

This is a great post from Uncle Bob (Object Mentor) and well worth a read. The next time someone tells you to write something quick-and-dirty, point them to this link or just read it again yourself :)

http://blog.objectmentor.com/articles/2007/12/13/business-software-is-messy-and-mgly 

Assembler still alive and well ….

Sunday, December 9th, 2007

gretel

Today I received an email from a person interested in the Win32 IO Completion Ports example I did in assembler almost a year ago. My response to him follows at the bottom of this post. The project web site is no longer reachable so when I can find the archive of the latest code I have Ill post it here and to the MASM forum.

Assembler is a great language and while it is very granular the simplicity is something I like a lot. I’m still keen on assembler but I don’t find as much time as I would like to do it. Here is an example of Assembler using the Microsoft Macro Assembler, so you can see it is now similar to using a higher level language:

align 4
main_cleanup_io_workers proc svr:PFASTSVR, err:PDWORD

mov edx, svr
invoke PostQueuedCompletionStatus,
       [edx].FASTSVR.io_completion_port, 0, OPERATION_ENDED, NULL

mov edx, svr
invoke CloseHandle, [edx].FASTSVR.io_workers

ret
main_cleanup_io_workers endp

Why use assembler? because it is fun and there is a sense of awe in being as close to the metal as possible. The performance is also rather astonishing. In this day and age of trying to be more ‘green’ and carbon neutral there is also a satisfaction in knowing you can write programs that do more with less CPU and therefore less hardware drawing power and requiring cooling.

*The picture above is of one of my dogs, gretel. She is a pug and she makes me smile every day. I use this image as my avatar in the MASM forum.

E^Cube,

Thank you for your message and for your interest in FASTserver.

As six_l points out that particular code snippet is an example / tutorial on what is involved in using IOCP with Win32. It only accepts one connection at present, because the focus was on the IOCP API and not threading.

I did start working on a ‘framework’ that incorporated the IOCP stuff, so others could just write a DLL and not worry about all the other stuff. However, this didn’t go far, as I got busy on a lot of other things.

I’d be *very* interested in doing a project with you and others, to make a finished server with IOCP.
My only requirement would be that we don’t just focus on Win32 but Linux as well. This isn’t as hard as you might think so don’t let the multi-platform requirement put you off.

If your interested in doing this and with me leading the project then get in touch with me here or in my blog. I’ll also post about some great books to read on the subject in my blog shortly.

Keep well,

Mopping Up With Groovy …

Wednesday, December 5th, 2007

I’m lucky to get to work with Brent Snook (Aegeon), a very smart guy, great coder and someone who is also a good presenter.

Recently at the Melbourne Groovy User Group Brent presented ‘Mopping Up With Groovy’, a presentation about the Groovy Meta-Object Protocol which underlies Groovy. The presentation was insightful and the code examples unique and they contained a touch of humor. They are attached.

Groovy is a very powerful language and the ability to add functionality to it at runtime is a very useful thing to be able to do, as the presentation shows. Understanding the Meta-Object Protocol is crucial to fully explore the power available to you.

mopping-up-with-groovy-brent-snook

An incredible tool and demo …

Saturday, December 1st, 2007

Rarely I see tools or demos of tools that blow me away, and yes they are typically from Apple. This one is not, but it left me awe struck. Please take a moment to check it out as it raises the bar on what can be done.

http://www.shapeshop3d.com/