From nobody Mon Sep 6 08:47:19 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 73DEB17AA9A4 for ; Mon, 6 Sep 2021 08:47:29 +0000 (UTC) (envelope-from mad@madpilot.net) Received: from mail.madpilot.net (vogon.madpilot.net [159.69.1.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H328d2LH6z3qgb; Mon, 6 Sep 2021 08:47:29 +0000 (UTC) (envelope-from mad@madpilot.net) Received: from mail (mail [192.168.254.3]) by mail.madpilot.net (Postfix) with ESMTP id 4H328V3rkpz6gN7; Mon, 6 Sep 2021 10:47:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=madpilot.net; h= content-transfer-encoding:content-language:content-type :content-type:in-reply-to:date:date:message-id:from:from :references:subject:subject:received; s=bjowvop61wgh; t= 1630918040; x=1632732441; bh=bF6FfWx4mKZrRJlCXMrgPI7cCWPANDIiJ5X /QOMyYoY=; b=NiKWmQB1KiG80jJ5JdWNmgmb3/QhGgo1VP9nbA98JAbWyMcTUKN Sn6j5NHMTTz371ckS0vg3CxTU3rqtQ5A99bNdPZbaF6ppdRn/n9mL1gFvKMh2HvZ mXM5bvU9y0wFqkX9Bt4oYRBalDEZZ37sFMEaOZR/N1f9vSWgR0yMF7kb9PRrd9nI 2lkLGtCgYB3lAbCg/2Q7RjmIedDV0T8crHOXKTyXUYoeKQuSJoJqGIftykeW364M xMuaatUSTMonAguNPEQP/IF91/vh+g99tHnZno8idfwpPCskHd0yVTw+JKKL2juI 9AaxrOQ/HYMvEDzREzlFXjPrf/W2wU1wlGg== Received: from mail.madpilot.net ([192.168.254.3]) by mail (mail.madpilot.net [192.168.254.3]) (amavisd-new, port 10026) with ESMTP id NHRU_h-wbvqG; Mon, 6 Sep 2021 10:47:20 +0200 (CEST) Subject: Re: -CURRENT compilation time To: Jeremie Le Hen , FreeBSD Current References: Message-ID: Date: Mon, 6 Sep 2021 10:47:19 +0200 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4H328d2LH6z3qgb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Reply-To: mad@madpilot.net From: Guido Falsi via freebsd-current X-Original-From: Guido Falsi X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org On 06/09/21 10:08, Jeremie Le Hen wrote: > Hey, > > I want to build -CURRENT again from sources. It's been a long time > since I hadn't done that. I'm shocked by the compilation time. > > I started the whole thing on Friday night and Monday morning it's > still in stage 4.2 (building libraries). Through occasional glancing > at the screen over the weekend, it seems obvious to me that the > compilation time is utterly dominated by LLVM. Compiling C++ seems > extremely CPU heavy and this is made worse by the fact LLVM is built > twice (once for build/cross tools, once for the actual world). > > So OK, my CPU is not the most powerful out there but it's still decent [1]. > > So I have a couple of questions coming to my mind: > 1. Is there any optimization I could benefit from? (I'm sure there's a > knob to use the existing compiler instead of building a > cross-compiler.) I'm routinely compiling head once a month or so on an "i7-6700 CPU @ 3.40GHz" (from dmesg), slightly more powerful than an i5 but this is a relatively old one so not top notch anymore. It usually takes less than 4 hours. I also build a NanoBSD image from scratch from time to time to an even older i5, which takes a little longer, but always under 6 hours, so the build times you report look anomalous. So as already suggested make sure yiu are using parallel make jobs (-j option to make) and memory is large enough (I think you need at least 2 GiB for make job is the minimum to not risk thrashing. You should really enable meta mode (look for WITH_META_MODE in src.conf(5)). It will not help the first time but will help a lot in future recompilations with an already populated /usr/obj. You could also investigate using ccache, which again will only help for successive rebuilds, and will consume a fair amount of disk space. Another consideration, my builds are happening on SSD disks, with swap on SSD, if you have everything on spinning media that is also a slowing factor. If you have plenty of ram you could build in ram, which is what I'm doing with poudriere for ports and it really speeds things up (even SSD disks tend to get slower when hit with a constant high load of mixed read/write accesses, which poudriere with parallel builds sometime causes) Hope this helps! -- Guido Falsi