A few years back, when I posted an analysis of how TValue is very slow, it prompted a lot of response from the community. Various people ran their own benchmarks, and started working on building or optimizing their own meta-value types. Some people are even still working on that today. But one of the most interesting things was Robert Love’s response. He looked at the TValue code and found a way that it could be optimized for the common case to speed things up. Continue reading ‘The next RTTI bottleneck’ »
Archive for the ‘Dark Corners’ Category.
Firebird is a great database, but it’s got one really irritating drawback: no native support for the boolean type. The standard solution to this issue is to create a BOOLEAN domain as a special restricted version of a smallint, and then make your database driver output the correct type.
The first part is easy. The second, not so much, if you want to use DBExpress. This really should be handled internally as a special case inside the DBX driver. Unfortunately neither Embarcadero nor Chau Chee Yang, maker of the alternative dbExpress Firebird driver, has released the source to their drivers, neither driver handles the BOOLEAN domain, and neither driver has any sort of callback/event handler that you can set up to intercept and modify the schema of a query result. But I’m not gonna let a little thing like that stop me! Continue reading ‘Adding boolean support to Firebird+DBX’ »
In my first look at Delphi XE, I wrote:
Oh, and apparently certain aspects of the compiler have slowed down. Most things will compile about the same speed or even a little faster, but for really large projects (millions of lines) with complex interdependencies between units, you’ll notice some slowdown, and it’ll apparently get worse the larger your project is. I timed it at work, on a project of about 3.5 million lines of code. It builds in about 2 minutes on D2010, closer to 3 minutes on XE. Bad, but still a heck of a lot better than the C family could do. And apparently it has something to do with making Generics work right, so I can tolerate that. Hopefully they’ll find some way to regain some of that lost speed in updates, though.
Well, I finally got around to installing XE Update 1 at work today, and I timed the build. 2:13. Continue reading ‘XE Update 1: you win some, you lose some’ »
Quick, what’s the output of this simple routine?
Continue reading ‘Beware using anonymous methods in loops’ »
What’s wrong with this code?
for i := 0 to Self.CheckedCount - 1 do
For those who haven’t seen it yet, due to popular demand, the StackOverflow people created a new site called programmers.stackexchange.com, a site for the more subjective questions that StackOverflow isn’t really designed for. Someone recently set up a poll: What’s your favorite programming language. You can probably guess what my answer was. Continue reading ‘Little things Delphi gets right’ »
I’ve been playing around with DeHL a lot lately. Embarcadero’s own Alex Ciobanu wrote this library, which provides a lot of useful functionality, including a set of querying methods that, while a bit bulky, are probably the best we’re gonna get until the compiler team gets around to implementing LINQ as a language feature. (Which I really hope they will do.) Continue reading ‘RTTI errors and omissions in Delphi XE’ »
A couple posts ago, I mentioned that I’ve been working with code generation lately. This is for a part of the TURBU project. An RPG relies pretty heavily on scripting, and RPG Maker, the system I created TURBU to replace, has a fairly extensive, if limited, scripting system. The limitations were one of the things that made me say “I could do better than this,” in fact: No functions, no local variables, callable procedures exist but parameters don’t, so any “passing” has to be done in global variables, only two data types: integer and boolean, no event handlers, minimal looping support, etc.
A lot of the UI design for the TURBU editor is based on data-aware controls bound to client datasets. I was trying to build a new form this morning that required me to filter one of the datasets. Problem is, that would break other things that expected it not to be filtered. Well, that’s not such a big problem, because TClientDataset has an awesome method called CloneCursor that lets you set up a second client dataset that shares the first one’s data store, but with independent view settings. So I used a cloned dataset, and immediately got an exception when I tried to run. The control I was using couldn’t find the field.
I really loved when Delphi 2009 came out, how it fixed so many ugly problems in the Delphi IDE. The stability issues and memory leaks that plagued D2006 and D2007 were greatly reduced. And it just got better in D2010.
The tradeoff, though, seems to have been compiler stability. Trying to do anything with Generics in D2009 before Update 3 came out was a nightmare, and even after, (and even in D2010,) there were still plenty of dark corners where you can end up with an Internal Compiler Error or linker error on something that, syntactically speaking at least, is perfectly cromulent Object Pascal.