From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 4F5A53857BA6 for ; Mon, 20 Nov 2023 13:52:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F5A53857BA6 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4F5A53857BA6 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::132 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700488329; cv=none; b=brkHCa7UltFhWzUqzuFvLkvUAd2Te8guvlXxqllNRM4SFgoEcvCidx+3W4VfQZ0DQOIqJyPmWthPCxx+eJrQ7+NsLmFMSil/hALBQg2TA2azPbHG7FZA9laOJQ2MPSCOitMnCfS1vso5zLwsxtZiqOg1NePo+Mf75eorXoFcri4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700488329; c=relaxed/simple; bh=OZYZ9VVtYzs7hMxVW5MdWfAxoK4Z+hHcE5/5b/QrC3A=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=QMrqlJHCJtPCv84kH24HndZ+DlYRP6v1ubgyi10p1jknUDJpNz/CXS6M9XdPpXsgP5wj9pyUNUl7r8wUdmGUKlFdc63sX+cwBLjmbEwtJ7XqE3AlmhL23kDSKgj21SOfu/2HFDCgeO5BiYwpZzpeHDhG48h0ShD5TOMU2rpdllY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-507973f3b65so6138298e87.3 for ; Mon, 20 Nov 2023 05:52:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700488326; x=1701093126; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4iREW/Q6gQc1FqUBdOgbVHEnLO6ZaHdM4n65VNM2fOY=; b=a/mRi2z0MYfl676/M1sa4kGinkcHOkFU5GmutZzwFAxNX5SU5iyFGYtO3/DKtXb6oj hCC0BphIn+zmO2NYcx17gvukIP6zhGNVaVFEOAqQisf9N+JlHOOuYfyfjMpQ+xtbeL8i I++cN/H0uiH9zIs+2UoK0sBeGhJxgI6o+iplYgD8RUTCXdb7FSPKYkQdPzmeQKCdv/lw 6nWwldhPPu32w7SjCeNCN6Yhci0ye6yZmHP+SmStLK9f0n9SyllR5D+sPCk8GX0LIBRa oYs88jIkGvnXC1Te1/Xek4eBGyuMwRUW39TVUGNXVzTenxvWuCIy2lr3jmV3vyscOUOL KRfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700488326; x=1701093126; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4iREW/Q6gQc1FqUBdOgbVHEnLO6ZaHdM4n65VNM2fOY=; b=LSqh6KRJ+6Orf9DOXO4//Su4TMEaG5wucazXlSaE3IEGD2XBFUvDo83p5YP9uhBr6x orxWlV4iyVESwNXlFsOtZ53fTLNFjK6R9Khl6JXKRBWjfBMjYF0j+97HtiP6h1v7wLjI mIQCfefwL1eealIEKDYuG4xTRgg5CSyW7MTLNeiSjbXWlbHKCqkgfasPtv7ANHU4FfMu dUe9O5IlJ1QBvoySAvDyPtvG10oiIIDD9YPk3MpEA03HLmGBrjF7NORqmSH5+QNuwW3A iKMfYzuxmc67zccjnSOcmfjQsfMBc407TSOYP8D2FdOOO8QNUDLHPp6JzEZ8gJcJ0oeU u0qg== X-Gm-Message-State: AOJu0YxUxooxJHlMYCWHipAnY2wwUTq2+gzlZUn1rTZEbSnbq1yvE9/S AufmW4WmY6D/PJvFTSfRgHV46WXAtoEpLNd1LuVnwSx/ktw= X-Google-Smtp-Source: AGHT+IFjTD+JWgDQnADE7AGCmxLdvEzu2Uj7bEiszjLyD8ZiBWNISosZMlpeV4TEXne5WZLP/cUHQhvSDy5IO5+NgdM= X-Received: by 2002:a05:6512:48d6:b0:50a:778b:590 with SMTP id er22-20020a05651248d600b0050a778b0590mr5269275lfb.68.1700488325376; Mon, 20 Nov 2023 05:52:05 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Damien Mattei Date: Mon, 20 Nov 2023 14:51:54 +0100 Message-ID: Subject: Re: n arity with method To: Per Bothner Cc: kawa@sourceware.org Content-Type: multipart/alternative; boundary="00000000000094312b060a95ca6f" X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --00000000000094312b060a95ca6f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable yes ,indexing is overloaded ,using same procedure for vector,string,hash table ,this take times but the slower is the infix precedence operator algorithm that is called each time even if the formula in a loop never change,example in: (for-each-in (j (in-range len_layer_output)) ; line (for-each-in (i (in-range len_layer_input)) ; column , parcours les colonnes de la ligne sauf le bias {M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] - {(- =CE=B7) * z_input[i] * =E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1=90= =81_i_o[j]}}) ; and update the bias {M_i_o[j 0] <- M_i_o[j 0] - {(- =CE=B7) * 1.0 * =E1=83=9Bz=E2=B3=86= =E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1=90=81_i_o[j]}})) {M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] - {(- =CE=B7) * z_input[i] * =E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1=90= =81_i_o[j]}} is expanded at each 'for' loop iteration in: ($nfx$ (bracket-apply M_i_o j (+ i 1)) <- (bracket-apply M_i_o j (+ i 1)) - (* (- =CE=B7) (bracket-apply z_input i) (=E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83 (bracket-apply z_output j) (bracket= -apply z=CC=83_output j)) (bracket-apply =E1=90=81_i_o j))) with evaluation of $nfx$ (see code in : https://github.com/damien-mattei/Scheme-PLUS-for-Kawa/blob/main/scheme-infi= x.scm) and many bracket-apply ( https://github.com/damien-mattei/Scheme-PLUS-for-Kawa/blob/main/apply-squar= e-brackets.scm ) even if the expression never change, the numeric computation change, but not the symbolic evaluation of operator precedence. This could be precomputed by Scheme+ before compilation by Kawa or any Scheme that use Scheme+ but this is a big work i have not begin. Damien On Sun, Nov 19, 2023 at 6:50=E2=80=AFPM Per Bothner wrote: > On 11/18/23 23:23, Damien Mattei via Kawa wrote: > > when comparing speed on the first part of my program written in Scheme+ > it > > run in 15" with Kawa and 7" in Racket. > > It is likely you can speed up Kawa quite a bit by fixing a few slow spots. > Specifically, anytime you do run-time reflection (or worse: eval/load) > you're > going to lose a lot of performance. If you can replace generic arithmetic > or vector/list indexing with type-specific arithmetic/indexing that can > also make a big difference. List processing (especially if you call cons > a lot) is always going to be relatively expensive. > > Profiling is probably the thing to try. I do little-to-no Java programming > these days, so I can't be any more specific with help. > -- > --Per Bothner > per@bothner.com http://per.bothner.com/ > --00000000000094312b060a95ca6f--