This is an archive of the discontinued LLVM Phabricator instance.

[YAML][NFC] Replace if-else with switch in createHNodes
ClosedPublic

Authored by Amir on Jul 5 2023, 3:32 PM.

Details

Summary

BOLT YAML profile reading time gets marginally faster (14.1572->13.9207 s) for
a large YAML profile (121MB/31K functions). Not claiming stat significance
though.

Diff Detail

Event Timeline

Amir created this revision.Jul 5 2023, 3:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 3:32 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Amir requested review of this revision.Jul 5 2023, 3:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 3:32 PM
Amir edited the summary of this revision. (Show Details)Jul 5 2023, 3:39 PM
Amir added a comment.Jul 5 2023, 3:48 PM

@njames93, @silvas, @grimar, @thomasfinch, @Bigcheese, @hintonda – folks, I checked blame on this function and picked you as most recent authors and reviewers.

I'm also looking for suggestions on how to speed up this function and parsing YAML in general. First thing that stands out in the profile is that we do allocate a lot of Nodes. But since they're allocated using BumpPtrAllocator I don't see much room for improvement here:
https://github.com/llvm/llvm-project/blob/49dfbc6efc64bcd9031bc80fd20f4be080ebf56e/llvm/include/llvm/Support/YAMLParser.h#L141

hintonda accepted this revision.Jul 5 2023, 8:49 PM

LGTM.

This revision is now accepted and ready to land.Jul 5 2023, 8:49 PM
This revision was automatically updated to reflect the committed changes.