---
title: "Discussion on \"Concurrent Map in Go vs Java: Yet Another Meaningless Benchmark\" | Hashnode"
description: "Discussion on \"Concurrent Map in Go vs Java: Yet Another Meaningless Benchmark\". We're comparing Java's ConcurrentHashMap and Go's xsync.MapOf in a totally non-scientific, unfair benchmark."
url: "https://hashnode.com/posts/concurrent-map-in-go-vs-java-yet-another-meaningless-benchmark/636562eef56b98b1f770a9b7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Concurrent Map in Go vs Java: Yet Another Meaningless Benchmark](https://puzpuzpuz.dev/concurrent-map-in-go-vs-java-yet-another-meaningless-benchmark?utm_source=hashnode&utm_medium=feed)

We're comparing Java's ConcurrentHashMap and Go's xsync.MapOf in a totally non-scientific, unfair benchmark.

Nov 4, 2022 · 3 min read · puzpuzpuz.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#go](https://hashnode.com/tag/go)
-   [#concurrency](https://hashnode.com/tag/concurrency)
-   [#benchmark](https://hashnode.com/tag/benchmark)

## Written by

[Andrei Pechkurov](https://hashnode.com/@puzpuzpuz)

@puzpuzpuz

  
[View profile](https://hashnode.com/@puzpuzpuz)

Top data race and segfault producer in the room.

Core database engineer at QuestDB. Distributed systems gazer. Node.js contributor. Occasional tech blogger and speaker.

## Responses 1

Markdown supported · ⌘↵ to post

[Shai Almog](https://hashnode.com/@codenameone)

[Nov 5, 2022](https://hashnode.com/posts/concurrent-map-in-go-vs-java-yet-another-meaningless-benchmark/636562eef56b98b1f770a9b7/comment/6365dd455efad7ad599cb8be)

Very interesting. What I would really like to know is how this scales to hundreds/thousands of threads. I suspect that with the current implementation Go will beat Java due to the limitations of system threads and with Loom we'll see Java turn that around.

[Andrei Pechkurov](https://hashnode.com/@puzpuzpuz)

[Nov 5, 2022](https://hashnode.com/posts/concurrent-map-in-go-vs-java-yet-another-meaningless-benchmark/636562eef56b98b1f770a9b7/comment/6365dd455efad7ad599cb8be#reply-636607825efad7ad599cbbfd)

Read operations will scale only with increased CPU core count. As for writes, they might scale better in Go with increased number of goroutines as long as the hash table bucket count is large enough. That's because of cheaper context switches in green threads vs OS threads. Project Loom may indeed change that.
