Don’t abuse FreeAndNil anymore

A recurring subject when it comes to freeing objects and preventing is whether you should just .Free them, thus leaving a invalid reference that should however never be used anymore when the code design is correct, or if you should defensively FreeAndNil() them, thus leaving a nil value that will hopefully trigger AVs more often on improper usage after release.

(more…)

SamplingProfiler v1.7.4

SamplingProfiler v1.7.4 is now available. This version adds an option for Delphi 2010 paths, and fixes a bug with the silent mode execution that would render it inoperative. There also have been other minor changes, mostly cosmetic.

This release also includes preparation for an “attach to process” option, which is currently not enabled, but should hopefully make in the next version (available “when ready”).

Profiling multi-threaded applications

SamplingProfiler has a few options to help profile a multi-threaded application which I’ll go over here.

In the current version, those options allow identifying CPU-related bottlenecks, as in “threads taking too much CPU resources or execution time”. However, they do not provide much clues yet to pinpoint bottlenecks arising from thread synchronization issues or serialization (insufficient parallelism). Hopefully, more support for profiling multi-threaded applications will come in future versions.

(more…)

SamplingProfiler v1.7.2

SamplingProfiler v1.7.2 has now been released.

This version includes the following changes:

  • added an option to display line numbers in the source preview
  • extended the process CPU affinity options to allow individually selecting up to 16 cores

The UI has been slightly rearrange to accomodate the CPU affinity options (I guess I’ll need to find something prettier for those upcoming 256 core CPUs…). There may be other indirect minor changes.

Printable versions of the articles

There is something about WordPress that reminds me of Delphi, not the language or the IDE, but the spirit. On the one hand, its a convenient and comfortable environment out of the box, to which ready-made functionality can be easily added, and on the other hand everything under the hood is still accessible and tweakable without having to fork in a major way (like Delphi, unlike most of the rest of them).

Anyway, I’ve added support for printable versions of the articles here, thanks to Lester Chan’s WP-Print, a wee bit of CSS & php tweaking is all it took. Hopefully the dead-tree lovers that asked for it should be satisfied, as well as those few that manually tried to append a “/print” to the url 😉

Code Optimization: Go For the Jugular

Code optimization can sometimes be experienced as a lengthy process, with disruptive effects on code readability and maintainability. For effective optimization, it is crucial to focus efforts on areas where minimal work and minimal changes will have to most impact, ie. go for the jugular

(more…)

ZJDBGPack re-release

ZJDBGPack is again available, but as an independent download (it used to be bundled with SamplingProfiler).

This is a command-line utility intended for use in a build process or from the Delphi tools menu, whose purpose is to integrate debug information into an executable. The debug information format  is a compressed version of JCL‘s JDBG.

As of know, SamplingProfiler is the only published utility that understands this format, so you can use it either to reduce the size of the executables you deploy for profiling purposes, or if you do not want to deploy directly-readable debug information files.