All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Pigeon's Device: An Independent Loop Optimization Technique in C Programming

By

gaul

4mo ago· 4 min readenInsight

Summary

The article introduces Pigeon's device, a loop optimization technique in C programming that was independently developed from Duff's device. The author explains that they created this technique for MS-DOS programming before learning about Duff's device, and describes how Pigeon's device was originally used in a function for comparing date/time records with different sort orders. The article compares the two techniques and discusses their similarities and differences in implementation.

Key quotes

· 5 pulled
Many may have heard tell of Duff's device, a rather neat loop optimisation technique in C.
This page provides details of Pigeon's device - a related but independently-originated technique.
The original instantiation of Pigeon's device was in a piece of C code written for MS-DOS before the days of the internet, so I had not heard of Duff's device.
When I did, the similarity between the techniques was immediately apparent.
The original Pigeon's device was in a function for comparing two date/time records in various different manners according to the desired sort order - FORWARD, forward chr
Snippet from the RSS feed
Many may have heard tell of Duff's device, a rather neat loop optimisation technique in C.

You might also wanna read