perf(lockfiles): Eagerly parse berry resolutions (#5417)
### Description
Each time we were resolving a dependency in the berry lockfile we were
creating an `Identifier` by parsing the contents of each resolution
entry. This resulted in us parsing these strings `|resolutions| *
|lockfile entries|` times causing a noticeable slowdown if either number
get large. To avoid this we eagerly parse the resolution entries upon
construction. This eagerness will be a speed up in all cases except for
if we parse the lockfile, but never use it.
I also removed some allocations that could be avoided in
`reduce_dependency` since it gets called as much as it does.
### Testing Instructions
Added an example with a large enough resolution list and lockfile to
incur poor performance.
Inspect the profile from running the example before and after the
change: `cargo instrument --example berry_resolutions`. (Requires
installation of
[cargo-instruments](https://crates.io/crates/cargo-instruments) along
with XCode dev tools)
Before: Overall execution of the example took 341ms and
`Resolution::reduce_dependency` was 245ms of that
After: Overall execution of the example took 62ms and
`Resolution::reduce_dependency` was 3ms of that
---------
Co-authored-by: Chris Olszewski <Chris Olszewski>