D29808: KSysGuard Network Plugin: Don't use std::regex to parse the network files.

2020-05-23 Thread David Korth
dkorth added a comment. The original version I wrote a few months back as a quick fix to reduce CPU usage. I do agree that the magic numbers shouldn't be hard-coded, since that's not easily maintained, though I'm not sure of the best approach. constexpr strlen() seems like it'd work, or

D29808: KSysGuard Network Plugin: Don't use std::regex to parse the network files.

2020-05-23 Thread Jiří Paleček
jpalecek added a comment. In D29808#673157 , @sandsmark wrote: > > It's all C code whereas the rest of the helper is C++. It also relies very heavily on magic numbers now. > > > > > I think a much simpler implementation would be to

D29808: KSysGuard Network Plugin: Don't use std::regex to parse the network files.

2020-05-20 Thread Martin Tobias Holmedahl Sandsmark
sandsmark added inline comments. INLINE COMMENTS > sandsmark wrote in ConnectionMapping.cpp:167 > instead of 87 + 1, maybe have a `constexpr int lineLength = strlen("0: > 0100:0277 : > 0A : 00:

D29808: KSysGuard Network Plugin: Don't use std::regex to parse the network files.

2020-05-20 Thread Martin Tobias Holmedahl Sandsmark
sandsmark added inline comments. INLINE COMMENTS > ConnectionMapping.cpp:157 > +// Should be within the first 16 characters. > +size_t data_start = data.find(':'); > +if (data_start >= 16) { if we're going for ultra optimized, const everything I guess. >

D29808: KSysGuard Network Plugin: Don't use std::regex to parse the network files.

2020-05-20 Thread Martin Tobias Holmedahl Sandsmark
sandsmark added a comment. > It's all C code whereas the rest of the helper is C++. It also relies very heavily on magic numbers now. > I think a much simpler implementation would be to split each line on " ", select the fields we want and clean them up. I assume this is for

D29808: KSysGuard Network Plugin: Don't use std::regex to parse the network files.

2020-05-18 Thread Arjen Hiemstra
ahiemstra requested changes to this revision. ahiemstra added a comment. This revision now requires changes to proceed. Hmm, this is good idea, I'm not really happy about the implementation though. It's all C code whereas the rest of the helper is C++. It also relies very heavily on magic

D29808: KSysGuard Network Plugin: Don't use std::regex to parse the network files.

2020-05-17 Thread David Korth
dkorth created this revision. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. dkorth requested review of this revision. REVISION SUMMARY std::regex is slow, so use fixed-field parsing instead. This is an initial version that I've been using for a while with no