Not the answer to your question but I don't think "TRT performs badly."

It is just that people sometimes assume that because it is a single
instruction in the Pop it must execute roughly as fast as many simple
instructions.

I think it is fast for what it does. Picture "writing TRT in assembler" --
implementing it as a subroutine as if the opcode magically vanished.

Now picture a version of that only somewhat faster because millicode has
some special tricks up its sleeve -- that's TRT.

If I had to count words in a string in assembler I would probably just use a
loop of CLI's and such -- unless there was some incredible need for
optimization. The big cost these days is getting the data into cache, and
that is all the same whether CLI, TRT, SRST, etc. TRT is perhaps a little
worse because you need to get two things into cache, the string and the
table. I might look first at SRST.

Charles

-----Original Message-----
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU]
On Behalf Of Paul Gilmartin
Sent: Thursday, June 14, 2018 12:18 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Count Words?

Is there a modern, clever, efficient way to count words in a string where:
o A separator is <TAB> or <SP> (+ others ad lib.)
o A word is a maximal non-empty sequence of consecutive non-separator
characters.
(Whew!)

Do TRT and CLI remain the best primitives?  (TRT is reported to
perform badly, perhaps model-dependent.)

Yah, I know: "The compiler knows best!"

-- gil

Reply via email to