Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update github.com/prometheus/procfs dependency #572

Merged
merged 2 commits into from
Apr 25, 2017
Merged

Conversation

grobie
Copy link
Member

@grobie grobie commented Apr 25, 2017

@SuperQ
Copy link
Member

SuperQ commented Apr 25, 2017

Needs rebase after XFS collector update.

@SuperQ
Copy link
Member

SuperQ commented Apr 25, 2017

Ahh, sorry, I messed up the rebase, will fix it.

@SuperQ SuperQ force-pushed the grobie/update-procfs branch from f2d12ba to d857581 Compare April 25, 2017 08:01
Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SuperQ SuperQ merged commit d31c294 into master Apr 25, 2017
@SuperQ SuperQ deleted the grobie/update-procfs branch April 25, 2017 08:25
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
tamcore pushed a commit to gitgrave/node_exporter that referenced this pull request Oct 22, 2024
In our project we need to parse proc maps pretty frequently and we've
noticed that there are lots of small allocations coming from parsing the
device and addresses from procfs' maps file.

The rough split of memory allocated is:
- bufio.(*Scanner).Text: 25%
- strings.Split: 50%
- string.Fields: 25%

The two callers of strings.Split are the two parsing functions that we
are optimising here. I've added some benchmarks to show the
improvements.

Before
======

```
$ go test -benchmem -run=^$ -bench ^BenchmarkParse.*$ github.com/prometheus/procfs
goos: linux
goarch: amd64
pkg: github.com/prometheus/procfs
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
BenchmarkParseAddress-12        12218004               123.0 ns/op            32 B/op          1 allocs/op
BenchmarkParseDevice-12         15074881                85.11 ns/op           32 B/op          1 allocs/op
PASS
ok      github.com/prometheus/procfs    2.978s
```

After
=====

```
$ go test -benchmem -run=^$ -bench ^BenchmarkParse.*$ github.com/prometheus/procfs
goos: linux
goarch: amd64
pkg: github.com/prometheus/procfs
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
BenchmarkParseAddress-12        28619314                50.45 ns/op            0 B/op          0 allocs/op
BenchmarkParseDevice-12         49721935                29.66 ns/op            0 B/op          0 allocs/op
PASS
ok      github.com/prometheus/procfs    2.991s
```

Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants