mirror of
https://github.com/coreutils/coreutils.git
synced 2026-10-28 09:44:34 +08:00
cut: -w: avoid per character function calls
Adding a couple of inlining hints to the compiler gives a 30% boost in raw character processing performance in cut_fields_mb_any(). $ yes $(yes eeeaae | head -n10K | paste -s -d,) | head -n10K > ll.in $ time LC_ALL=C.UTF-8 src/cut-before -f1 -w ll.in >/dev/null real 0m2.279s $ time LC_ALL=C.UTF-8 src/cut-after -f1 -w ll.in >/dev/null real 0m1.619s * src/cut.c (scan_mb_blank_field): Tag as inline. (scan_mb_delim_field): Likewise.
This commit is contained in:
1 parent
1ee46ac2c9
commit
f665fdffca
1 file changed
+2
-2
@@ -497,7 +497,7 @@ append_field_1_bytes (mbbuf_t *mbbuf, mcel_t g, idx_t *n_bytes)
|
||||
append_field_1_chunk (mbbuf_char_offset (mbbuf, g), g.len, n_bytes);
|
||||
}
|
||||
|
||||
static enum field_terminator
|
||||
static inline enum field_terminator
|
||||
scan_mb_blank_field (mbbuf_t *mbbuf, struct mbfield_parser *parser,
|
||||
bool *have_pending_line, bool write_field,
|
||||
idx_t *n_bytes)
|
||||
@@ -534,7 +534,7 @@ scan_mb_blank_field (mbbuf_t *mbbuf, struct mbfield_parser *parser,
|
||||
}
|
||||
}
|
||||
|
||||
static enum field_terminator
|
||||
static inline enum field_terminator
|
||||
scan_mb_delim_field (mbbuf_t *mbbuf, bool *have_pending_line,
|
||||
bool write_field, idx_t *n_bytes)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user