Giter Club home page Giter Club logo

crofiler's People

Contributors

dependabot[bot] avatar hadrieng2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

crofiler's Issues

Use std Backtrace once that is old news

Rust 1.65 stabilizes the std Backtrace type, which means that this project will soon be able to do with one less build dependency. Let's switch to it once that release is old enough to be featured in, say, the ubuntu repos.

Investigate interoperability with Firefox Profiler

Crofiler expends most of its complexity budget on the Hard Problem of parsing and simplifying C++ entity names with unknown source file context. We probably don't have enough developer brain time to additionally produce a higher-quality profile visualization along the lines of what Firefox Profiler does for perf.

But could we have a third crofiler visualization frontend that just emits some data file that Firefox Profiler can consume, and offload all advanced visualization concerns to Firefox Profiler?

The main unknown to be investigated is whether Firefox Profiler supports, or can be made to support, the simplified/full entity name dichotomy that is the soul of crofiler. And if not, whether we're okay with emitting only simplified entity names.

Automatically generate explicit template instantiations

In practice, the most common way to resolve template bloat in Acts has been to outsource some of it to a separate source file. One standard way to do it in C++ is explicit instantiations + extern template. Could crofiler automatically generate some of this boilerplate?

Better entity name simplification

Right now, C++ entity name simplification works as follows:

  • Treat the entity name as an AST-like tree
  • Have a way to do a depth-first walk of the tree that displays nodes, which truncates at a certain AST depth where the corresponding tree node is replaced by an ellipsis โ€ฆ.
  • Repeat render at increasing depth until we go past the terminal columns budget, take previous depth.

This algorithm works well enough to offer the basic desired functionality, but has a number of known issues:

  • Duplicated work. When we go to depth n+1, we repeat the rendering work we did for depth n, which itself repeats the rendering work we did for depth n-1. Furthermore, we don't leverage the node interning work that the parser carried out to deduplicate rendering work across similar AST nodes. This makes rendering of lots of entity names needlessly inefficient, which so far has not been a priority to optimize because last time I checked crofiler was mostly parsing-bound.
  • Does not fully leverage available horizontal space. Sometimes, we could render some AST nodes at depth n+1, but we don't because rendering all AST nodes at that depth would blow our terminal columns budget.
  • Does not priorize AST nodes. For example, entity paths through namespaces can be quite important for the reader trying to identify what type we are talking about, compared to other information like the exact set of template parameters that is passed to a generic function or type. More subtly, repeating the same information multiple times is not making efficient use of our terminal columns budget, so if a certain type has appeared once in an entity name, we may want to summarize its display more the second and third times it appears in the same entity name.
  • Does nothing to avoid ambiguities. The single most important caveat to simplifying entity names is that it can make two slightly different entity names look the same, and it would be great if the display algorithm was tuned to favor keeping simplified names unambiguous if at all possible.

I'd like to try something along the lines of the following alternative algorithm instead:

  • Pre-render all entity names to be displayed at present time, leveraging AST node interning for work deduplication + some sort of span markers to tell which parts of the rendered name correspond to which interned AST nodes.
  • Keep simplified entity names sorted by decreasing terminal columns using something like a BinaryHeap.
  • As long as the longest entity name uses too many terminal columns, try to simplify it.
    • Go through all top-level nodes, sort them by decreasing terminal column budget and try to simplify each of them in turn.
    • For each simplified display, compare it to all other displays in flight to see if it is now ambiguous with another existing display. If so, reject the simplification in this first pass (we'll do it only if we have to).
    • If we don't manage to find a node to simplify at the currrent depth, try at the next depth, and so on until we reach the leaf depth.
    • If we reached all AST leaves without simplifying the name enough, then start a more aggressive simplification pass where we accept ambiguity and thus simplification always succeeds.
  • Once the entity name's display gets short enough, put it back into the list, and somehow avoid re-doing the same work as I move to the next-longest entity name which may have AST nodes in common with previously processed entity names.
  • If the basic approach can be proven to work, gradually make it more sophisticated to incorporate the other concerns mentioned above.

I expect this to be a rather costly feature development, so it should only be done if this project starts to get more traction.

Pretty-print non-simplified entity names

In addition to the simplified entity name displays in the symbol list, in TUI mode, crofiler provides a full display in the lower half of the screen. It would be great if this full display were pretty-printed with proper attention to the compromise between keeping things readable and not using too much vertical space.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.