<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/why-you-should-tune-code-before-your-garbage-collector-7dmf5pz8z" -->

---
title: Why You Should Tune Code Before Your Garbage Collector
description: A benchmark-driven analysis showing that optimizing Java code (specifically removing redundant SLF4J logging) has a far greater impact on latency than tuning...
canonical: https://daily.dev/posts/why-you-should-tune-code-before-your-garbage-collector-7dmf5pz8z
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why You Should Tune Code Before Your Garbage Collector | daily.dev
og:description: A benchmark-driven analysis showing that optimizing Java code (specifically removing redundant SLF4J logging) has a far greater impact on latency than tuning...
og:url: https://daily.dev/posts/why-you-should-tune-code-before-your-garbage-collector-7dmf5pz8z
og:image: https://api.daily.dev/og/posts/7dMf5PZ8Z.png
og:image:alt: Why You Should Tune Code Before Your Garbage Collector
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.

# Why You Should Tune Code Before Your Garbage Collector

**[Hacker News](https://daily.dev/sources/hn)** · 4 min read · 1 upvotes · 0 comments

## Summary

A benchmark-driven analysis showing that optimizing Java code (specifically removing redundant SLF4J logging) has a far greater impact on latency than tuning the garbage collector. Using JLBH to test Chronicle-FIX at 50K messages/second, the results show that eliminating one log line per message reduces p99.99 latency by three orders of magnitude — from ~20ms down to single-digit microseconds. Crucially, this code change also flips the preferred GC: Shenandoah performs best with logging enabled but worst without it, while Parallel GC becomes the top choice in the optimized scenario. The key takeaway is to optimize your workload before tuning GC settings, since the workload itself determines which GC is optimal.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <http://blog.vanillajava.blog/2026/06/why-you-should-tun-code-before-your.html>

## Similar posts on daily.dev

- [Java Is Fast. Your Code Might Not Be.](https://daily.dev/posts/java-is-fast-your-code-might-not-be--melyfth7m) · Hacker News · 0 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/why-you-should-tune-code-before-your-garbage-collector-7dmf5pz8z)

```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":"Why You Should Tune Code Before Your Garbage Collector","url":"https://daily.dev/posts/why-you-should-tune-code-before-your-garbage-collector-7dmf5pz8z","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-you-should-tune-code-before-your-garbage-collector-7dmf5pz8z"},"datePublished":"2026-07-13T19:41:38.361Z","dateModified":"2026-07-13T19:41:59.921Z","description":"A benchmark-driven analysis showing that optimizing Java code (specifically removing redundant SLF4J logging) has a far greater impact on latency than tuning...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cc06a86ff2f5f539f68c34500159142e?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cc06a86ff2f5f539f68c34500159142e?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Hacker News","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":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/why-you-should-tune-code-before-your-garbage-collector-7dmf5pz8z","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,java,jvm","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"Why You Should Tune Code Before Your Garbage Collector"}]}
```

