From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server-vie001.gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_OTHER_BAD_TLD, URIBL_DBL_BLOCKED_OPENDNS,URIBL_ZEN_BLOCKED_OPENDNS autolearn=no autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=new2025; t=1757692396; bh=7HzbJSggrLYVXkISVCQPVL3aAvdjNXrMnh5LIT850PI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type:Content-Transfer-Encoding:Message-ID:Date:From: Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=VsHI8T3dyunFlxVZWH1DEs3/aSYMzBKvSrPH24b799LcUaJHfdusYb1oLZ6wDaiNX NRMaIySK/ARY7NG5aFXAlX43JY74dW69K7T0cokrIZwq2POkknJWJJ3sg66+d3CT5h U2f559leKTI39x9tym0jXjaK58buILdM9SXki10JpNSoN24MVR6z3UphEYyVMXNAXP YZ5CiR5gRyTY5nKMOzm3VsDZh0FYWVPQKOwNSJ9I1CmrSwjF/fN/dVAW7ZT/uOa411 cMgiavnDKWKrouWQ3+nMP5tTw9gIjlQIyz9tpUPy41lkCWhA0atRooy/Iuh1ZS/4T6 Ph6wlFXmtWENg== Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 1CAE631279DB for ; Fri, 12 Sep 2025 15:53:16 +0000 (UTC) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-570d0c280e4so1208287e87.0 for ; Fri, 12 Sep 2025 08:53:16 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWcDjag72jPTZbcWUMvCDsZlj8beYF4YvGPL1Daa8H16wG+0/+6Ro0Lgaq3cgCgRySH73Hy@vger.gnuweeb.org X-Gm-Message-State: AOJu0Yz1gGCOOLmn3apWu70yiRWf1if0LZB5GbNBhidC9su0U1AqDU6P wmr0MzH4AkDheB9fuOslyNv6/G1ouJMQiOoQpiVE1xwZL2IyKooayFNpP3eysybOiv8EWisFF1g MvkyxqQqiEZBKhxioj0h6MSA9XpNIMo4= X-Google-Smtp-Source: AGHT+IHi3imevBryMGNU51SjRTnPy57mjvFw12F25xQzbSx5J9wnAp/7UUYb1B7XVeng1OU+d7WNU1k3sJOTGNefBXY= X-Received: by 2002:a05:6512:a84:b0:56b:9958:517c with SMTP id 2adb3069b0e04-5704bcda7a2mr1071555e87.19.1757692395512; Fri, 12 Sep 2025 08:53:15 -0700 (PDT) MIME-Version: 1.0 References: <20250910104326.580778-1-reyuki@gnuweeb.org> <20250910104326.580778-3-reyuki@gnuweeb.org> In-Reply-To: From: Ahmad Gani Date: Fri, 12 Sep 2025 22:52:38 +0700 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXxaxsJqSlaLvZeQ5kjLwv3tTK-yI0RIWKrCVbnEa-Fr67z4y7nnja8U4zY Message-ID: Subject: Re: [PATCH gwproxy v10 2/2] gwproxy: refactor code base to add experimental raw DNS backend To: Alviro Iskandar Setiawan Cc: Ammar Faizi , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: On Fri, Sep 12, 2025 at 9:39=E2=80=AFPM Alviro Iskandar Setiawan wrote: > On Fri, Sep 12, 2025 at 5:37=E2=80=AFPM Ahmad Gani wrote: > > In this case, would it be better to allocate both sess_map and stack.ar= r > > in a single block, so we only call realloc once? > > Why would it be better? > > I don't think it's worth adding more complexity around it just to get > a non noticeable performance gain, unless you have the numbers? > > It'll complicate the reallocation much, as you have to memmove() > around the values yourself. In fact, realloc() may return the same > pointer if it internally doesn't need to expand, or may even use > mremap() in case the memory was directly allocated via mmap() to > expand it without the need to call memmove(). My initial thought is not about performance, but because it can eliminate the previous problem of two realloc when either realloc fails. but after a second thought, I think I can just update the stack.top instead of defer it. Does this diff look ok? https://github.com/realyukii/gwproxy/commit/352c80e00c53dd8e1459745a2e456d9= 3ee3c8af0 -- Ahmad Gani