Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1642818 > unrolled thread
| Started by | Alexey Dobriyan <adobriyan@gmail.com> |
|---|---|
| First post | 2017-05-16 22:50 +0200 |
| Last post | 2017-05-17 09:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] seq_file: delete small-value optimization Alexey Dobriyan <adobriyan@gmail.com> - 2017-05-16 22:50 +0200
Re: [PATCH] seq_file: delete small-value optimization Joe Perches <joe@perches.com> - 2017-05-17 09:20 +0200
| From | Alexey Dobriyan <adobriyan@gmail.com> |
|---|---|
| Date | 2017-05-16 22:50 +0200 |
| Subject | [PATCH] seq_file: delete small-value optimization |
| Message-ID | <tHRzQ-1XD-11@gated-at.bofh.it> |
num_to_str() optimizes printing small integers [0..9], so the same
check higher in callchain is unnecessary.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/seq_file.c | 10 ----------
1 file changed, 10 deletions(-)
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -694,11 +694,6 @@ void seq_put_decimal_ull(struct seq_file *m, const char *delimiter,
if (m->count + 1 >= m->size)
goto overflow;
- if (num < 10) {
- m->buf[m->count++] = num + '0';
- return;
- }
-
len = num_to_str(m->buf + m->count, m->size - m->count, num);
if (!len)
goto overflow;
@@ -733,11 +728,6 @@ void seq_put_decimal_ll(struct seq_file *m, const char *delimiter, long long num
num = -num;
}
- if (num < 10) {
- m->buf[m->count++] = num + '0';
- return;
- }
-
len = num_to_str(m->buf + m->count, m->size - m->count, num);
if (!len)
goto overflow;
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-05-17 09:20 +0200 |
| Message-ID | <tI1pv-8sr-9@gated-at.bofh.it> |
| In reply to | #1642818 |
On Tue, 2017-05-16 at 23:42 +0300, Alexey Dobriyan wrote: > num_to_str() optimizes printing small integers [0..9], so the same > check higher in callchain is unnecessary. Doesn't the optimization exists for the frequent use of 0 in seq output? These seq_put_decimal calls are now slightly more expensive.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web