<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/principles-of-mechanical-sympathy-ktcus6sk5" -->

---
title: Principles of Mechanical Sympathy | daily.dev
description: Mechanical sympathy is the practice of writing software that works with hardware rather than against it. Four core principles are covered: predictable...
canonical: https://daily.dev/posts/principles-of-mechanical-sympathy-ktcus6sk5
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Principles of Mechanical Sympathy | daily.dev
og:description: Mechanical sympathy is the practice of writing software that works with hardware rather than against it. Four core principles are covered: predictable...
og:url: https://daily.dev/posts/principles-of-mechanical-sympathy-ktcus6sk5
og:image: https://api.daily.dev/og/posts/KTcUs6sk5.png
og:image:alt: Principles of Mechanical Sympathy
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Principles of Mechanical Sympathy

**[Martin Fowler](https://daily.dev/sources/mafo)** · 10 min read · 0 upvotes · 0 comments

## Summary

Mechanical sympathy is the practice of writing software that works with hardware rather than against it. Four core principles are covered: predictable sequential memory access (which leverages CPU prefetching), cache line awareness and false sharing (padding variables to avoid contention between threads), the single-writer principle (dedicating one thread per resource to eliminate mutex overhead and enable batching), and natural batching (greedily building batches as data arrives rather than waiting for fixed timeouts or sizes). A practical example of an AI text embedding service illustrates how these principles combine to eliminate head-of-line blocking and improve throughput. The article also emphasizes measuring performance before optimizing.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://martinfowler.com/articles/mechanical-sympathy-principles.html>

## Similar posts on daily.dev

- [The Renaissance, Mechanical Sympathy, and AI Agents](https://daily.dev/posts/the-renaissance-mechanical-sympathy-and-ai-agents-9xgejfdek) · Nx · 2 upvotes · 1 comments
- [Hardware Stockholm Syndrome](https://daily.dev/posts/hardware-stockholm-syndrome-wxlbuyh4z) · Hacker News · 2 upvotes · 1 comments
- [The Automation of Empathy: How Do You Technically Build Simulated Empathy?](https://daily.dev/posts/the-automation-of-empathy-how-do-you-technically-build-simulated-empathy--7pbluivao) · Codemotion · 0 upvotes · 0 comments
- [Software Engineering Principles Help Get More out of AI](https://daily.dev/posts/software-engineering-principles-help-get-more-out-of-ai-g2d3tqsex) · Telerik · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance)

[View this post on daily.dev](https://daily.dev/posts/principles-of-mechanical-sympathy-ktcus6sk5)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Principles of Mechanical Sympathy","url":"https://daily.dev/posts/principles-of-mechanical-sympathy-ktcus6sk5","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/principles-of-mechanical-sympathy-ktcus6sk5"},"datePublished":"2026-04-07T13:48:44.354Z","dateModified":"2026-04-07T13:49:15.118Z","description":"Mechanical sympathy is the practice of writing software that works with hardware rather than against it. Four core principles are covered: predictable...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ee215ce327cf87d8091736e57ace0833?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ee215ce327cf87d8091736e57ace0833?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Martin Fowler","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Martin Fowler","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/mafo","url":"https://daily.dev/sources/mafo"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/principles-of-mechanical-sympathy-ktcus6sk5","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Martin Fowler","item":"https://daily.dev/sources/mafo"},{"@type":"ListItem","position":3,"name":"Principles of Mechanical Sympathy"}]}
```

