# ROS 2 Rolling updates rosbag2 to use faster MCAP library

Published 2026-11-11 · Robotics.world Team · Robotics.world

> ROS 2 Rolling has updated rosbag2 to use a newer MCAP library, which is expected to make bag writing somewhat faster. Foxglove’s separate benchmarks describe performance changes across MCAP’s language libraries, including faster LZ4 writes in C++ and Go.

Chris Lalancette wrote in an [Open Robotics Discourse](https://discourse.openrobotics.org/t/improved-write-performance-for-mcap-rosbag2/59691) post: “We’ve also updated rosbag2 in ROS 2 Rolling to take advantage of the new library, so writing your bags should be a bit faster than before.”

In a separate account of the library work, [Foxglove](https://robotics.world/companies/foxglove) reported that C++ LZ4 writes were about eight times faster on a fixed-payload benchmark than in January 2026. That result measures an MCAP library workload, not a quantified speedup for every rosbag2 recording.

## Changes to the writers

MCAP is the default recording format for ROS 2 and stores timestamped messages in an indexed file. Foxglove and open-source contributors built a shared benchmark harness for the format’s C++, Rust, Go, Python and TypeScript libraries and used it to examine write and read behavior.

The change to the LZ4 defaults puts the C++ and Go writers into fast compression mode rather than their previous high-compression paths. Foxglove’s measurements found faster writes with that setting, but larger files; the existing slower compression settings remain available.

The pull request for that change notes that rosbag2 is unaffected by the compression-default change out of the box because it defaults to uncompressed writing. The C++ writer also changed its default zstd compression level to match the other library implementations, a change that trades compression speed for smaller files.

## Checks and compression

For C++ and Go, changes to CRC calculation batch the work rather than repeatedly processing small writes. The Rust writer similarly batches CRC updates; its pull request says written bytes and CRC values are unchanged.

Another Rust change reuses the zstd compression context and its thread pool across chunks in the same file, rather than creating a fresh set of worker threads for each chunk; Foxglove says it cut the number of new threads created by about 150x. The work covers library implementations and configurations beyond the specific rosbag2 update announced on Discourse.

## What the tests measure

The benchmark harness runs a fixed-payload scenario with a million 100-byte messages on one channel, alongside a simulated ten-second recording with five channels and a filtered-read test. The simulated recording includes sensor data at different rates and sizes, including an IMU and camera frames.

The published write results are medians of 10 write times from two back-to-back runs on an AMD Ryzen AI MAX+ 395, pinned to 3.0 GHz and writing to a RAM-backed filesystem. Foxglove cautioned that differences of a few percent on that setup should be read as noise, and that the speedups measured for individual changes are not necessarily the same as end-to-end write-time differences.

## Read-side work

For reading, the Python ROS 2 decoder was changed to reuse generated message classes, reducing memory use when dynamically decoding repeated or nested message types. The TypeScript reader can also opt in to caching the MCAP message index, which Foxglove says made subsequent reads 23–34% faster.

The cache’s benefit depends on the input: its pull request says it is especially effective when individual reads have latency, while an in-memory buffer would see little to no gain. The write benchmarks in Foxglove’s account do not measure those read-side changes.

## Sources

1. Original source [Open Robotics Discourse](https://discourse.openrobotics.org/t/improved-write-performance-for-mcap-rosbag2/59691) discourse.openrobotics.org

Other pages read

2. [Foxglove](https://foxglove.dev/blog/measuring-and-improving-mcap-performance) foxglove.dev
3. [Foxglove on GitHub](https://github.com/foxglove/mcap/pull/1640) github.com

## Companies in this story

- [Foxglove](https://robotics.world/companies/foxglove)

## Related stories

- [ROS 2 simulation study reports faster, repeatable tests](https://robotics.world/news/ros-2-simulation-study-repeatable-parallel-tests)
- [Developer posts native ROS 2 Jazzy build for Apple Silicon](https://robotics.world/news/developer-posts-native-ros-2-jazzy-apple-silicon-build)
- [StrataSLAM is released for multi-floor mapping in ROS 2](https://robotics.world/news/strataslam-multi-floor-mapping-ros-2)
- [Arduino introduces RouterBridge_ROS for bringing board I/O into ROS 2](https://robotics.world/news/arduino-direct-ros-2-bridge-ventuno-q)
- [Stanford’s GGraph Unites GPU Robot Learning and ROS 2](https://robotics.world/news/stanford-ggraph-gpu-robot-learning-ros2)

## Explore

[More articles](https://robotics.world/news)

---

Canonical: https://robotics.world/news/ros-2-rolling-rosbag2-mcap-write-performance
