HomeSoftware Heritage

model: avoid another extra creation of Model object

Description

model: avoid another extra creation of Model object

Do not create model object while sorting entry before creating model
object.

This is another case of "let us create object X to prepare the creation
of object X", slowing things down.

In practice, we will likely skip this code-path after the next
changeset, however this seems useful to get this performance footgun
out the way.

We tested this change on simple information of the Mercurial loader,
with a noop-loader stockage:

swh loader run mercurial https://foss.heptapod.net/mercurial/mercurial-devel directory=/data/repos/mercurial-devel

Median time of 3 run

before 12 minutes 59 seconds
after: 11 minute 56 seconds

On a profile of the same run, the to_model call of the from_disk's Directory class took the following percentage:
before: 24%
after: 17%

Details

Provenance
marmouteAuthored on Sep 22 2022, 6:12 PM
marmoutePushed on Sep 26 2022, 2:28 PM
Differential Revision
D8527: model: avoid another extra creation of Model object
Parents
rDMOD814a6c8416d5: from_disk: only build a model object once
Branches
Unknown
Tags
Unknown
Build Status
Buildable 31740
Build 49663: test-and-buildJenkins console · Jenkins