Posted by on in Blogs
Placing your code in the forge - Refining a technique While preparing for this posting, I had the chance to review the code in my Parallel.pas unit.  I was trying to get my implementation of TNestedTask<T> to work properly with nested functions.  The problem I had is that with Win32 generics, you cannot have BASM (Built-in ASseMbler) blocks in the bodies of the methods in a parameterized type.  So I needed to find a way to call a function pointer that can take a type parameter as the result type.  The thing is that dependi...
Tags: CodeGear

Posted by on in Blogs
When code lies - A better solution Many of you wretched and guffawed at my silly post about Stupid Enumerator Tricks. You know what? I agree. It was a hideous misuse of a feature. One comment from Joe White that stood out was the notion that the code was lying. He is right. I was using a a side-effect as the primary feature, not what the code was actually saying. However, from casually observing the code in question, it could easily be misconstrued. The code was lying. How would the maintainer of this code figure out the intent a...

Posted by on in Blogs
Automated Testing - Learn it, Live it, Love it   Steve Trefethen may be an ex-CodeGear employee, but he is still adding significant value to the developer community as a whole.  Looks like he's started a series of posts where he'll talking about test automation and the advantages it gives you.  Sure, everyone knows about unit-testing (at least you should), but Steve is talking about a much more holistic approach to automated testing.  Here at CodeGear we have a significant internal investment in automated testing tools, e...
Tags: CodeGear
Stupid Enumerator Tricks - And now for something completely different Sometimes I get admittedly kooky, crazy ideas.  While playing with Tasks, ParallelFor, and Thread Pooling, a rather interesting thought popped into my head.  I've been pouring over the very interesting ideas and techniques outlined in this article on MSDN that is referring to the Parallel FX library that is in the works for the .NET framework.  One thing I've been looking at is how to make something like this applicable to natively compiled code in Delphi for Win32.  While I ...
Tags: CodeGear
Magical Assembler Incantations - Nested functions and anonymous methods A few folks left some comments on my Life and Times of a Thread Pool post asking to comment on and explain what those little snippets of assembler do in the LocalParallelLoop() function in the TThreadPool class.  You can get the code to which I'm referring in this Code Central entry. First a little background.  Object Pascal has long supported the notion of nesting functions and procedures within each other.  This is a very powerful way to better hide implementation details and ma...

Posted by on in Blogs
Delphi, Adelphi, &amp; Flickr Back in March of this year, you may recall that I'd traveled throughout Australia and parts of Asia.  While in Australia I visited Sydney, Melbourne and Brisbane.  While in Melbourne I stayed at a rather eclectic hotel with the rather apropos name, Adelphi. It was very much a "bohemian" place to stay.  So much so that I had to take a few photos of the room.  Throughout the trip, I'd uploaded some of these photos to my Flickr account.  Thinking of it no further. Then on O...

Posted by on in Blogs
The Life and Times of a Thread Pool As promised in this post, I've uploaded a demo project to Code Central. This is an implementation of Conway's Game of Life using a thread pool and a parallel loop. It uses a 500x500 wrapping grid in which only a portion is displayed in the UI. No calculations of the next generation are done in the UI thread in either parallel or serial mode. While the implementation of the life algorithm is interesting, that is not the intent of this demo. The Parallel.pas unit is the main focus of this demo. Th...

Posted by on in Blogs
I cut and I cut and it was still too short! In keeping with the notion that I'm highly fallible and flawed human like so many others I just have to relay an important epiphany I had while playing some more with thread pools, parallelization of loops, and using a different thread pool technique. Actually, more than a week ago I'd planned on writing up this simply simply stellar posting about how "simple" paralleling can be done and the overall results of some "research" I'd been doing (you know, the 'R' in R&D). I'd even posted a lit...

Posted by on in Blogs
You want to do what? I always get a kick out of reading Raymond Chen's blog, The Old New Thing.  So many of his posts hit home way too often :).  One of his latest posts simply highlights one thing I always try to do and get folks to do when they ask for support or help with such-and-such.  I've caught myself doing this same thing many times.  Don't ask how to implement your grandiose solution, simple present the problem you're trying to solve and then present your proposed solution.  Why p...
Tags: CodeGear
Enumerators, Inlining, methods on records, for-in and deadlocks The ever-present, over-achieving Hallvard Vassbotn has just posted an excellent analysis of how the Delphi compiler generates code for the "for-in" statement. He also presented many suggestions on how to make this as efficient as possible.  I will be taking his suggestions back to the team to get folded into the next release.  You should also be sure to read Primoz Gabrijelcic's blog posts on writing enumerators.   I noticed that I haven't gotten any "bites" on my challenge to spo...
Tags: CodeGear

Check out more tips and tricks in this development video: