# Optimizing Integer-to-IP Conversion in Common Lisp

DevFeed: [Optimizing Integer-to-IP Conversion in Common Lisp](<https://devfeed.tech/articles/a-worthwile-micro-optimisation-34521.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2013/10/a-worthwile-micro-optimisation/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2013-10-03T20:10:00Z

Content type: article

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [Common Lisp](<https://devfeed.tech/topics/common-lisp.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [code](<https://devfeed.tech/tags/code.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [lisp](<https://devfeed.tech/tags/lisp.md>), [little](<https://devfeed.tech/tags/little.md>), [optimisation](<https://devfeed.tech/tags/optimisation.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>)

## AI overview

This article describes a Common Lisp micro-optimization for converting integer values to IP representations while loading geolocation data into PostgreSQL. It precomputes dotted-byte representations at load time, substantially reducing the transformation's added cost.

## Source excerpt

In our previous article about Loading Geolocation Data, we did load some data into PostgreSQL and saw the quite noticable impact of a user transformation. As it happens, the function that did the integer to IP representation was so naive as to scratch the micro optimisation itch of some Common Lisp hackers: thanks a lot guys, in particular stassats who came up with the solution we're seeing now.