Optimize CSV monitor output for 2x runtime#412
Conversation
PhilipFackler
left a comment
There was a problem hiding this comment.
This approach is great! Nice results. Thanks for spending time on this. Looks like I trusted the std::ostream buffer too much. 😸
I would like you to revert the structure a bit, though.
I think you should use this approach for all of the formats. No need to have extra custom CSV functions and separate bits in the ValuePrinter. Use the string buffer in the controller (call it something generic like buffer_ instead of csv_line_) and change the print* functions internally to use the interface you've made here for appendCsv. You could change them to append also, to make it clearer (don't need two different implementations for the same thing). You shouldn't have to bother much with the implementations for the other formats (just switch to using stringstream).
In other words, just replace my implementation with yours everywhere. 😆
How does that sit with you?
|
Also, shouldn't this be aimed at |
I can change the target branch, I only kept it like this because I measured it against my other branch, not this one! I will shift target so it's async with the other PR. Good on unifying across the three formats, I just don't know much about yaml. Otherwise as long as you and @pelesh are okay with this, I can certainly extend this to the other formats and make api clearer. Thank you for the feedback! |
They all use |
Description
This stacked PR optimizes CSV monitor output in PhasorDynamics by formatting CSV values directly into a reusable line buffer in the hot monitor path. It is stacked on #411 (
lukel/perf-sys-dev).Proposed changes
VariableMonitorBasewith existing stream-print fallbacks.std::to_charsfor floating-point output.VariableMonitorControllerand write each CSV row once.Performance was measured with
application/PhasorDynamics/PDSimusing the app-reportedComplete intime. Each row reports the median of 3 trials after rebuildingPDSimon the corresponding branch.lukel/perf-sys-dev(s)Checklist
-Wall -Wpedantic -Wconversion -Wextra.Further comments
stoked