Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Alex Newsgroups: comp.lang.forth Subject: Re: EXIT THEN Date: Sat, 11 Feb 2017 13:16:09 +0000 Organization: A noiseless patient Spider Lines: 51 Message-ID: References: <20170211075559.5d4b2fc3@_> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 11 Feb 2017 13:14:21 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="483c4f5160458c89fa6368fa013a1c60"; logging-data="16015"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KzDitIXplkOG6QzVeciWFf9D0FraF6wI=" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 In-Reply-To: <20170211075559.5d4b2fc3@_> Cancel-Lock: sha1:aHkJZEMOQR9zP968ccAivol5oR0= Xref: csiph.com comp.lang.forth:54790 On 2/11/2017 12:55, Rod Pemberton wrote: > On Fri, 10 Feb 2017 18:13:43 -0800 (PST) > hughaguilar96@gmail.com wrote: > >> On Friday, February 10, 2017 at 6:43:56 PM UTC-7, HAA wrote: > >>> Coding style may influence this. For SwiftForth 0= IF NOT IF >>> appear 200 times compared to ?EXIT (151) EXIT-THEN (227). >>> >>> Numbers matter but decisions are made on less. Take ANS words NIP >>> and TUCK. SwiftForth: NIP (158) TUCK (56) >>> NIP and TUCK are conveniences - additions to the language that don't >>> fundamentally change anything. >> >> ANS-Forth was designed by Forth Inc. that in 1994 was using ITC and >> knew essentially nothing about code optimization. >> >> NIP is the same as: SWAP DROP >> TUCK is the same as: SWAP OVER > > NIP and TUCK are prime examples of why I said your used. I made a similar point to Anton about his superinstructions some > years ago (or perhaps it was superoperators or some similar concept...). > If you look at the counts for NIP and TUCK and compare them to those > posted by Marcel for various word combinations, NIP and TUCK aren't > used that much by anyone. This is because they're simply of low need, > not in widespread use anywhere, and they weren't standard for a long > time. > >> In a non-optimizing compiler, making NIP and TUCK into primitives >> (written in assembly-language) causes them to execute about twice as >> fast as having two primitives compiled (either SWAP DROP or SWAP OVER >> for NIP and TUCK respectively). > > Why should anyone implement infrequently executed words as primitives? The argument was about how frequently programmers write certain words or phrases. Their execution frequency is another matter, as is their overall effect on an application's performance. > If you're going to implement them as primitives, i.e., you don't care > about optimizing your time or investment, you might as well go ahead and > implement all Forth words as primitives. > > > Rod Pemberton > -- Alex