#965 Copy modules instead of reparsing them
Merged 6 years ago by lsedlar. Opened 6 years ago by sgallagh.
sgallagh/pungi module_copy  into  master

file modified
+1 -1
@@ -196,7 +196,7 @@ 

          for module_id, mmd in variant.arch_mmds[arch].items():

              # Create copy of architecture specific mmd to filter out packages

              # which are not part of this particular repo.

-             repo_mmd = Modulemd.Module.new_from_string(mmd.dumps())

+             repo_mmd = mmd.copy()

              repo_mmd.set_arch(tree_arch_to_yum_arch(arch))

              artifacts = repo_mmd.get_rpm_artifacts()

  

@@ -59,7 +59,7 @@ 

          for mmd in variant.mmds:

              mmd_id = "%s-%s" % (mmd.get_name(), mmd.get_stream())

              if mmd_id not in variant.arch_mmds[arch]:

-                 arch_mmd = Modulemd.Module.new_from_string(mmd.dumps())

+                 arch_mmd = mmd.copy()

                  variant.arch_mmds[arch][mmd_id] = arch_mmd

  

          # Contains per-module RPMs added to variant.

The Modulemd.copy() method has been available since libmodulemd 1.1
and is much faster than dumping to a string and parsing it again.

Signed-off-by: Stephen Gallagher sgallagh@redhat.com

The change looks good to me. I'll rebase on current master and merge.
Does it need to be deployed now? The speedup does not seem significant enough to warrant this.

Commit ec96757 fixes this pull-request

Pull-Request has been merged by lsedlar

6 years ago

The change looks good to me. I'll rebase on current master and merge.
Does it need to be deployed now? The speedup does not seem significant enough to warrant this.

Zero urgency. This was just something I noticed while poking around the code.