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

Fix ASN1 freezes and latency on big input #61

Merged
merged 5 commits into from
Mar 9, 2024

Commits on Mar 9, 2024

  1. fix(crypto-helper): asn1: improved default hex bytes rendering.

    It turned out that rendering absolute all bytes of the asn1 node is a
    bad idea (ironically). It has caused big performance problems and latency.
    Now we render only first `MAX_BYTES_TO_RENDER` / 2 and last `MAX_BYTES_TO_RENDER` / 2
    bytes of the asn1 node if the overall amount of bytes is greater
    than `MAX_BYTES_TO_RENDER`. Currently, `MAX_BYTES_TO_RENDER` is equal to `512`.
    TheBestTvarynka committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    1e8528f View commit details
    Browse the repository at this point in the history
  2. refactor(crypto-helper): asn1: use reference counting to reduce data

    cloning.
    
    Previously, for every hex byte node, NodeOptions component, copy operation,
    and so on, the app has cloned entire node bytes. This patch introduces
    the `RcSlice` structure. This structure represents the slice with multiple
    owners. But actually, it's just a `Vec` in the `Rc` plus range.
    
    These changes affect the hex viewer and `NodeOptions` components the most.
    We don't want to cause a big refactoring for now.
    
    We have better performance and memory efficiency. `Vec`s cloning now is
    not a bottleneck. But the noticeable freezes are still present.
    TheBestTvarynka committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    71bb147 View commit details
    Browse the repository at this point in the history
  3. refactor(crypto-helper): asn1: improve performance using rendering

    and formatting hacks.
    
    Reduced different conversions from `T` into `Classes` as much as possible.
    It was unexpected, but a lot of `Classes` object constructions can cause
    performance issues.
    
    Replaced the `format!("{:02x?}", byte)` macro invocation with a simple
    function with a big match that returns a static string.
    TheBestTvarynka committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    7a5e21b View commit details
    Browse the repository at this point in the history
  4. fix(asn1-parser): utctime: neeeded buf length calculation.

    Add one byte to the overall length. This byte represents
    the 'Z' chat, that usuallu is placed in the end of the utc
    time object.
    TheBestTvarynka committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    4150fdc View commit details
    Browse the repository at this point in the history
  5. feat(crypto-helper): asn1: improve loadong from local storage.

    Now the data will also be set in the input textarea during
    loading from local storage.
    TheBestTvarynka committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    28570c4 View commit details
    Browse the repository at this point in the history