Comments (9)
Yeah, it's sad to have to always sort even when we know most of the time the input is already sorted, but I do agree that it would be best to remain as compatible as possible with upstream.
I'll do some benchmarks to see what the performance difference is.
from inferno.
tests/data/collapse-perf/results/example-perf-stacks-collapsed.txt
from inferno.
I just realized that the output of difffolded.pl
is not sorted. This is not a problem for the Perl version of flamegraph since it always sorts the input lines. But in inferno's implementation of flamegraph the lines are only sorted if there are multiple input files that need to be merged. The assumption was that if only one file is passed, the input will already be sorted. That's not the case when creating differential flamegraphs.
We could deal with this in one of the following ways:
- Diverge from upstream and have our version of diff-folded sort lines before writing them out.
- Always sort the lines in flamegraph like the Perl version does it.
- In flamegraph, detect early if it's a differential and only then sort the lines.
Thoughts?
from inferno.
Hmm, that's a good point... I'm tempted to do (1), but that would mean that we're not compatible with files generated by upstream's difffolded.pl
, which would be sad. Unfortunately, (2) is also pretty dissatisfying as it would mean you need to read the entire input before you can process any of it. I like (3), but I worry that not doing (2) means that there will be weird cases where the user has non-sorted folded output and passes it to us expecting it to just work.
Amidst all these, I think (2) is sadly the right way to go. It will likely give us quite a performance hit since we can no longer do streaming work. Quantifying that would be good (shouldn't be too hard now with #88). At least we can use sort_unstable
, so there's that 🤷♂️
from inferno.
I think it's not even so much the sorting itself, but the collect
we have to do in order to sort.
from inferno.
Yeah, I get that. Here are the benchmarks.
No sorting:
time: [5.3512 ms 5.3765 ms 5.4020 ms]
thrpt: [114.13 MiB/s 114.67 MiB/s 115.21 MiB/s]
Sorting:
time: [5.7031 ms 5.7364 ms 5.7740 ms]
thrpt: [106.77 MiB/s 107.47 MiB/s 108.10 MiB/s]
change:
time: [+7.5874% +8.3936% +9.3059%] (p = 0.00 < 0.05)
thrpt: [-8.5136% -7.7436% -7.0523%]
Performance has regressed.
from inferno.
Okay, so not quite as bad as I'd thought then.
from inferno.
I'll add a PR for the flamegraph benchmark since #88 only added benchmarks for collapse.
from inferno.
That seems like an excellent plan! What input are you using?
from inferno.
Related Issues (20)
- More Firefox rendering issues HOT 1
- `inferno 0.11.8` removed sealed `CollapsePrivate` trait from public API HOT 1
- Lower level API to flamegraph renderer HOT 1
- Color diffusion mode gives less useful results in flamechart mode HOT 2
- Support for simplifying recursive function calls as stackcollapse perl scripts HOT 7
- Support for collapsing source lines from -F+srcline in `perf script` outputs HOT 1
- atty 0.2 has a potential unaligned read HOT 3
- 0.11.15 build fails on Rust 1.62 HOT 1
- Single stack detection can be wrong if the event contains multiple colon HOT 3
- `Input data ends in the middle of a stack.` when using on result of attaching HOT 1
- Differential output tooltips are confusing HOT 4
- Differential output only calculates diff correctly for leaves (most specific frames) HOT 4
- support hot/cold flamegraphs HOT 1
- Document cargo features in readme HOT 1
- flamegraph does not contain sys_enter_* calls with params HOT 3
- Documentation, especially of folded format HOT 3
- publish packages HOT 5
- Error in generated SVG: PCDATA invalid Char value (macos) HOT 5
- Dependencies versions too loose HOT 1
- wallClockProfiler support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inferno.