Bug 112630 - pkg_install [patch] Registering of ports and creation of packages takes a long time
Summary: pkg_install [patch] Registering of ports and creation of packages takes a lon...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-13 15:20 UTC by Stephen Montgomery-Smith
Modified: 2007-07-21 23:50 UTC (History)
0 users

See Also:


Attachments
file.diff (5.45 KB, patch)
2007-05-13 15:20 UTC, Stephen Montgomery-Smith
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Montgomery-Smith 2007-05-13 15:20:09 UTC
Registering of ports when doing "make install", for ports that have many 
dependencies (e.g. x11/gnome2), or making packages using "make package",
takes a very long time.  A significant part of the problem is in the
function sortdeps in deps.c, which uses a rather inefficient bubble sort.
Comment 1 Pav Lucistnik freebsd_committer freebsd_triage 2007-05-13 15:31:58 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Move over to bin, assign to portmgr
Comment 2 Toomas Pelberg 2007-06-01 05:47:27 UTC
Tested the patch, appears to "work" for me.
Comment 3 Dominic Fandrey 2007-06-16 21:46:43 UTC
I am using the patch since Stephen first posted it on the mailing list:

http://lists.freebsd.org/pipermail/freebsd-ports/2007-May/040794.html

It did not cause any trouble so far and the speed improvement is extremely
significant. Together with Stephens other patch that has just been commited:

http://www.freebsd.org/cgi/query-pr.cgi?pr=112765

the registration time of x11/xorg went down from ~15 minutes to 18 seconds on
one of my systems.
Comment 4 Pav Lucistnik freebsd_committer freebsd_triage 2007-06-16 21:54:14 UTC
State Changed
From-To: open->analyzed

This patch is currently being tested in exprun
Comment 5 Pav Lucistnik freebsd_committer freebsd_triage 2007-06-18 23:43:59 UTC
State Changed
From-To: analyzed->patched

Committed to HEAD; pending MFC
Comment 6 dfilter service freebsd_committer freebsd_triage 2007-06-18 23:49:21 UTC
pav         2007-06-18 22:49:13 UTC

  FreeBSD src repository (doc,ports committer)

  Modified files:
    usr.sbin/pkg_install/lib deps.c 
  Log:
  - Replace rather inefficient bubble sort with a recursive depth-first search.
    This speeds up registration of packages considerably.
  - style(9) police welcome!
  
  PR:             bin/112630
  Submitted by:   Stephen Montgomery-Smith <stephen@cauchy.math.missouri.edu>
  Tested by:      bento i386 experimental run
  MFC after:      14 days
  
  Revision  Changes    Path
  1.12      +111 -65   src/usr.sbin/pkg_install/lib/deps.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Pav Lucistnik freebsd_committer freebsd_triage 2007-07-21 23:50:24 UTC
State Changed
From-To: patched->closed

This was MFC'ed to 6-STABLE some time ago.
Comment 8 Stanislav Sedov freebsd_committer freebsd_triage 2014-06-01 06:35:47 UTC
Hi!

Thanks for the patch! However, it contains a some of style(9) bugs:

+    nrpkgs = 0;
+    while (pkgs[nrpkgs]) nrpkgs++;

Should looks like:
+    while (pkgs[nrpkgs])
+	nrpkgs++;

+    listed = alloca(nrpkgs);
+    if (listed == NULL) {
+        warnx("%s(): alloca() failed", __func__);
+        return 1;
+    }
+    bzero(listed,nrpkgs);

missing spaces

+    check_loop = alloca(nrpkgs);
+    if (check_loop == NULL) {
+        warnx("%s(): alloca() failed", __func__);
+        return 1;
+    }
+    bzero(check_loop,nrpkgs);

missing spaces

+    newpkgs = alloca(nrpkgs*sizeof(char*));

the same

+    if (newpkgs == NULL) {
+        warnx("%s(): alloca() failed", __func__);
+        return 1;
+    }
+    nrnewpkgs = 0;
+
+    for (i = 0; pkgs[i]; i++) if (!listed[i]) {

missing newline & indentation. Also non style(9) check (should be
listed[i] != 0).

     }
+    for (i = 0; i < nrnewpkgs; i++) pkgs[i] = newpkgs[i];
+
missing newline.


+                    list_deps(pkgs
[j],pkgs,listed,check_loop,newpkgs,nrnewpkgs,err_cnt);
+                    listed[j] = 1;
+                    newpkgs[*nrnewpkgs] = pkgs[j];
+                    (*nrnewpkgs)++;
+                }

spaces.

Again, thanks for your work!