New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #18259 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Improve mportsearch performance

Reported by: blb@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 1.8.0
Component: base Version: 1.8.0
Keywords: search mportsearch performance Cc: jmr@…
Port:

Description

Attached is a patch which changes how mportsearch works:

  • now it always reads in all of each PortIndex available in ${sources}
  • goes through the cached data from that read to find possible matches

From a speedup point-of-view, it appears to increase the speed of multiple mportsearches in one run of port by 20%+. For example, running a dry-run install of gnome (port-test is a trunk-based installed with no ports installed):

$ time port-test -dy install gnome > gnome_orig.txt 2>&1

real    1m10.154s
user    1m0.102s
sys 0m9.089s

After the attached patch:

$ time port-test -dy install gnome > gnome_patch.txt 2>&1

real    0m50.689s
user    0m43.276s
sys 0m6.508s

The disadvantage is that memory usage increases; watching top for both of the above tests shows the original peaking at about 344M, the patched at about 419M (so about a 20% increase in memory usage).

The debug output from each is identical.

As the dependency tree has been increasing lately (use_* adding the proper deps, various X11-based changes) speeding this up is becoming more important.

Attachments

macports.tcl.diff Download (7.9 KB) - added by blb@… 3 years ago.
patch to base/src/macports1.0/macports.tcl
quickindex.diff Download (11.8 KB) - added by jmr@… 3 years ago.
quickindex-array-blb.diff Download (12.8 KB) - added by blb@… 3 years ago.
New patch to fix issue with multiple repos
quickindex-array.diff Download (14.1 KB) - added by jmr@… 3 years ago.

Change History

Changed 3 years ago by blb@…

patch to base/src/macports1.0/macports.tcl

Changed 3 years ago by jmr@…

There's another approach that I'd like to compare against this. Stay tuned.

Changed 3 years ago by jmr@…

Changed 3 years ago by jmr@…

  • cc jmr@… added

Here's a patch that adds a new "quick index" and a new mportlookup proc, which maps a single port name to its PortIndex entry.

Changed 3 years ago by jmr@…

Performance comparison:

Original
port outdated52.61
sudo port -y install gnome1:19.46
Quick index
port outdated6.12
sudo port -y install gnome19.31

Changed 3 years ago by blb@…

To compare against my earlier results, quickindex-array.diff shows:

$ time port-test -dy install gnome > gnome_patch2.txt 2>&1

real	0m26.863s
user	0m18.970s
sys	0m6.854s

using a max of 340M of memory. So faster than my update without the memory cost. Note that this was after the PortIndex.quick file had already been generated, though that definitely doesn't take much time either.

Changed 3 years ago by blb@…

Added new patch to change handling of quick_index variable and work better with multiple repositories.

Changed 3 years ago by jmr@…

Updated again: now being smart about not reading the quick index when it's just been generated, added some comments, renamed a couple of variables for clarity.

Changed 3 years ago by blb@…

New patch to fix issue with multiple repos

Changed 3 years ago by blb@…

Update my version again so it works with multiple repos, basically, quicklist in _mports_load_quickindex needs to be unset if it exists, otherwise the first repo's quicklist is used for the second repo.

Changed 3 years ago by jmr@…

Update: decompose generation of the quick index into its own proc, and call the new proc from the portindex script.

Changed 3 years ago by jmr@…

Changed 3 years ago by jmr@…

Update: change PortIndex.quick to have one entry per line, and update PortIndexRegen.sh to include PortIndex.quick.

Changed 3 years ago by jmr@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from MacPorts Future to MacPorts 1.8.0

Committed in r47110.

Note: See TracTickets for help on using tickets.