[Jprogramming] Difference between 5^100x and x: 5^100
Dan Bron
j at bron.us
Wed Oct 8 06:50:09 HKT 2008
I wrote:
> I don't understand
Regarding your comment:
> dd ,:1 2 NB. The result exceeds ":
> 1+i.1 2
Ah, I see. You're saying (dd >&# ":) ,: 1 2 . Well, keep two things in mind:
(A) For large arguments, dd will either dramatically beat or tie with ": . For small arguments, the differences will be
minute and probably overshadowed by the mechanism of communication [1]. Take my example where two J servers are connected via
sockets for this case: Nagel's algorithm (and the size of a TCP/IP packet) virtually guaruntee neither message will arrive sooner
[1]. Which brings me to my second point.
(B) These two verbs do different things. The point of my J IPC protocol was to send data from one J session to another, such
that the receiving J server received an exact copy of the noun sent by the sending J server. Now note:
(-: ".@:":) ,: 1
0
(-: ".@:dd) ,: 1
1
the result of ".":y is not guarunteed to be the same as y (for the reasons discussed elsewhere in this thread). Which just
means we're not really comparing apples-to-apples in the first place.
And, in the interests of full disclosure, I will note that while our initial J IPC protocol leveraged this feature of 5!:5 , we
changed it in a later release to use 3!:1 . The cost of sending large nouns when 5!:5 couldn't find a terse J expression
which resulted in that noun far outstripped the gains from the cases where it could.
-Dan
More information about the Programming
mailing list