Bug 262092 - net/samba413: Set PYTHONHASHSEED to improve build time
Summary: net/samba413: Set PYTHONHASHSEED to improve build time
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Stefan Eßer
URL:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2022-02-21 10:50 UTC by Christian Ullrich
Modified: 2022-03-15 21:58 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (timur)
koobs: merge-quarterly?


Attachments
Patch. (467 bytes, patch)
2022-02-21 10:50 UTC, Christian Ullrich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Ullrich 2022-02-21 10:50:31 UTC
Created attachment 231985 [details]
Patch.

Samba's Python-based build system, waf, will with high probability rebuild the entire source during stage because it does not maintain the order of compiler arguments. This appears to defeat its own minimal-rebuild logic, and defeats ccache in most cases.

Patch attached; reducing build time by ~50 %. If ccache is in use, it does not waste cache space on single-use objects and thereby improves the overall hit rate of a shared ccache.

Two successive poudriere builds without the patch had port times of 13:18 and 13:22 minutes respectively. With the patch, the times were 6:05 and 5:47 minutes, all measured with "hot" ccache (i.e. the times are for the ccache lookups only, and the builds without the patch had cache hits for the different command lines as well).

The upstream distribution's root Makefile already sets PYTHONHASHSEED to avoid this issue, but the port skips it by invoking waf directly.
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-03-11 15:06:54 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=243bc134121f464a3a7b39a85debc78ddf2e8274

commit 243bc134121f464a3a7b39a85debc78ddf2e8274
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-03-11 15:00:50 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2022-03-11 15:00:50 +0000

    net/samba41[23]: set PYTHONHASHSEED during build

    The build with CCACHE can be significantly sped up by passing
    PYTHONHASHSEED=1 in the environment to make the build reproducible
    with regard to the compiler commands issued.

    PR:             262092
    Reported by:    chris at chrullrich.net (Christian Ullrich)

 net/samba412/Makefile | 1 +
 net/samba413/Makefile | 1 +
 2 files changed, 2 insertions(+)