Deutsch English Français Italiano |
<101f9oo$18edp$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.awk Subject: substr() - copying or not copying, that is here the question. Date: Sat, 31 May 2025 18:12:06 +0200 Organization: A noiseless patient Spider Lines: 15 Message-ID: <101f9oo$18edp$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Sat, 31 May 2025 18:12:08 +0200 (CEST) Injection-Info: dont-email.me; posting-host="8f546bb770637d72a5a6c4814d126025"; logging-data="1325497"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yec20fV3tO5GVS0sGejUK" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:/fM9eD2SJJXUOrbG5ZWa+BhF5kc= X-Mozilla-News-Host: news://news.eternal-september.org:119 X-Enigmail-Draft-Status: N1110 In the context p=index(substr(t,s),r) it would not be necessary to copy the substr(t,s), the index() function could operate on the original using some access "descriptor" (say, a pointer and a length) in read-only mode. Will (GNU) Awk do a copy of the data value or does it use a read-only descriptor access to the already existing substring of variable "t"? Currently I'm playing with some huge data and copies of MB sized data is costly (if it's repeatedly done with various substr() subscripts). Janis