The distinction you are looking for is between _lazy_ and _eager_ stream processing. JE is eager (your second proposed strategy).

The realities of vector processors, which are ubiquitous on modern hardware, mean that the ideal approach is not quite lazy or eager, but somewhere in between, an approach which has an elegant representation as the transposition of a 3-dimensional array (only 2 dimensions are necessary to distinguish between lazy and eager processing; the 3rd dimension is a logical vector length). Vector processing means that, while je is likely to be bottlenecked by memory bandwidth, performance is probably not as bad as you might expect.

There are also a couple of corners of je which _are_ lazy, after a fashion. These are documented on wiki as 'virtual nouns'; see https://code.jsoftware.com/wiki/Vocabulary/SpecialCombinations#Virtual_Nouns

 -E

On Sun, 24 Jul 2022, tu...@posteo.de wrote:

Hi,

How is J processing data?

Would this one-liner

 +/ 1 + i.100

be processed like this:

tmp=0
create '0'
add '1' add to tmp
create '1'
add '1'
add to tmp
create '2'
add '1'
add to tmp
...
print tmp

or like this:

tmp=0
alloc 100*sizeof(int)
fill mem with numbers 0...99
for each field in mem: add '1'
for each fied in meme: add field to tmp
print tmp

so basically "streaming" vs. <missing word here>
Background:
The streaming version would allow for much bigger ranges
of input

Cheers!
Meino



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to