diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-12-04 14:44:57 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2020-12-08 20:58:40 +0100 |
commit | 157086e750187f6bceeea697d10bf58403c7d5de (patch) | |
tree | 82c6512c1a1e88c9ab9f77ca9bf1531da265e331 /MemoryMeter.c | |
parent | 5506925b346b09f8556ce2c8f83fe3d69dc1c03c (diff) |
Split RichString_(append|appendn|write) into wide and ascii
RichString_writeFrom takes a top spot during performance analysis due to the
calls to mbstowcs() and iswprint().
Most of the time we know in advance that we are only going to print regular
ASCII characters.
Diffstat (limited to 'MemoryMeter.c')
-rw-r--r-- | MemoryMeter.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/MemoryMeter.c b/MemoryMeter.c index ad846527..e4754427 100644 --- a/MemoryMeter.c +++ b/MemoryMeter.c @@ -34,18 +34,18 @@ static void MemoryMeter_updateValues(Meter* this, char* buffer, size_t size) { static void MemoryMeter_display(const Object* cast, RichString* out) { char buffer[50]; const Meter* this = (const Meter*)cast; - RichString_write(out, CRT_colors[METER_TEXT], ":"); + RichString_writeAscii(out, CRT_colors[METER_TEXT], ":"); Meter_humanUnit(buffer, this->total, sizeof(buffer)); - RichString_append(out, CRT_colors[METER_VALUE], buffer); + RichString_appendAscii(out, CRT_colors[METER_VALUE], buffer); Meter_humanUnit(buffer, this->values[0], sizeof(buffer)); - RichString_append(out, CRT_colors[METER_TEXT], " used:"); - RichString_append(out, CRT_colors[MEMORY_USED], buffer); + RichString_appendAscii(out, CRT_colors[METER_TEXT], " used:"); + RichString_appendAscii(out, CRT_colors[MEMORY_USED], buffer); Meter_humanUnit(buffer, this->values[1], sizeof(buffer)); - RichString_append(out, CRT_colors[METER_TEXT], " buffers:"); - RichString_append(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer); + RichString_appendAscii(out, CRT_colors[METER_TEXT], " buffers:"); + RichString_appendAscii(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer); Meter_humanUnit(buffer, this->values[2], sizeof(buffer)); - RichString_append(out, CRT_colors[METER_TEXT], " cache:"); - RichString_append(out, CRT_colors[MEMORY_CACHE], buffer); + RichString_appendAscii(out, CRT_colors[METER_TEXT], " cache:"); + RichString_appendAscii(out, CRT_colors[MEMORY_CACHE], buffer); } const MeterClass MemoryMeter_class = { |