Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Logging is kind of slow, even at levels below the level selected for the node.

Aperta
#2,928 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
cpp

Direzione di ricerca

Inizia con il riproduttore ROS 2 collegato in src/roslog.cpp e confronta i relativi timing WARN-level e /rosout-subscriber con quelli dell'esempio ROS 1 collegato. Il lavoro sarà completato quando sarà stata concordata una modifica che riduca l'overhead del logging disabilitato e il costo aggiuntivo di /rosout, e sarà stata misurata nuovamente la differenza di timing riportata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I have a minimal reproducible example here.

In that example, I start a timer that only runs once that does a calculation in a for loop, logging as it goes. I measure the time it takes to do the calculation and also log that at the end. I run the process with the logger level for the node set to WARN, so the INFO statements aren't printed to the terminal or published.

I would expect that I would see a minimal slow down compared to not logging at all (ignoring missing optimizations), when in reality I see quite a large impact.

On my laptop, for the scenario described above I'm seeing the process take 0.0149388s to complete, where the equivalent code in ROS1 completed the process in 0.000248744s.

FWIW, its not just that logging is slower in ros2 than ros1. When I set the log levels so I can see the statements, ros1 finishes in 1.04641s compared to ros2 at 0.895799s. If I subscribe to rosout, the time for ros2 doubles to 1.62014s, though.

This seems unfortunate? I discovered this when porting some code from ros1 to ros2 that had log statements in some critical sections of the code, and wound up fixing the issue by using spdlog directly for those sections.

The fact that subscribing to /rosout has such a big effect is even more unfortunate, in my opinion. It is an additional place that people coming from ros1 don't expect counts as making a network call that really is when doing subsystem testing and verification.

Is there a way this can be improved? The ros1 behavior seems much better

Lingua principale
C++
Stelle
805
Fork
564
Merge medio
1g 22h
PR unite (30g)
21

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ros2/rclcpp

Tutte le issue di ros2/rclcpp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.