Skip to content

DLKit_appImagesContain is slow #1

@oryonatan

Description

@oryonatan

Hi @johnno1962, one of our devs complained that loading the injection bundle on startup freezes the main thread for around 1 second.

I've ran this under a profiler, and it seems like the issue stems from the the call to DLKit_appImagesContain which spends quite a long time on ImageSymbols::trie_populate()

seems like most of the time is spent on
std::__1::map<void const*, char const*, std::__1::less<void const*>, std::__1::allocator<std::__1::pair<void const* const, char const*>>>::operator[](void const* const&)
maybe this can be solved by replacing the map with std::unordered_map?

other stuff that takes less time (and might be harder to optimize)
other things that take time

170.00 ms 10.6% exportsTrieTraverse
112.00 ms  7.0% void std::__1::sort[abi:de180100]<std::__1::__wrap_iter<TrieSymbol*>>(std::__1::__wrap_iter<TrieSymbol*>, std::__1::__wrap_iter<TrieSymbol*>)
37.00 ms  2.3% std::__1::map<void const*, char const*, std::__1::less<void const*>, std::__1::allocator<std::__1::pair<void const* const, char const*>>>::~mapabi:de180100

see attached screenshot from the profiler

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions