kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

Is this a 1 to 1 reimplementation, or a hobbiest interpretation? #488

Closed carkat closed 6 years ago

carkat commented 6 years ago

The question says it all. I'm curious about if this language is authentic to the original implementation, or merely copies the syntax? Where can I find more information about the k implemented by Kx, is there one available?

From the website, I only find q available for use, and I enjoy it much less than I do Kona, but I'm unsure of the performance of Kona, where as q seems to be vouched for as it is released by kx directly.

bakul commented 6 years ago

On Wed, 07 Feb 2018 16:02:49 -0800 carkat notifications@github.com wrote: carkat writes:

The question says it all. I'm curious about if this language is authentic to the original implementation, or merely copies the syntax? Where can I find more information about the k implemented by Kx, is there one available?

From the website, I only find q available for use, and I enjoy it much less than I do Kona, but I'm unsure of the performance of Kona, where as q seems to be vouched for as it is released by kx directly.

There are a few differences: The most important is that an int on 64 bit word machines is 64 bits, so on kona "*/32#2" return 2^32, while on k3 it returns 0. kona mailing list may have an old message listing differences.

k3 came with kdb, a relational database layer on top of k3. This doesn't exist in kona.

kona is not as fast as k3 and can be much slower for some things. This may only matter if you are doing some heavy number crunching.

kx.com doesn't distribute k3 any more but IIRC q/k4 for x86 is available for free. You may be able to find k3 "in the wild". I believe kona wiki has links to user and reference manuals for k3.

Note that in q if you just type \ followed by return, you get to k4, which is similar to k3 but not same.

tavmem commented 6 years ago

For a listing of some of the differences see open issues 225 and 226.

tavmem commented 6 years ago

Regarding a target for closing the differences ... see open issue 29.

tavmem commented 6 years ago

Regarding speed ... there are a 2 interesting issues to review:

Open issue 127 addresses a single line of code that (originally) kona took 50 times longer than k2.8 to execute. After fixing regressions and making adjustments we got it down to about 7 times longer. The issue is still open (for further improvement).

Closed issue 228 addresses the "ray-tracer" app developed by Stefan Aptar. ( http://nsl.com/k/ray/ray.k ) Originally, it failed in kona, but now works and the issue was closed. However, kona is significantly slower than k3.2 on this app. Here the caus) of the slowness is different. There are 7 separate functions. There is an "outer-loop" and an "inner-loop" function. The functions get executed repeatedly. It is my belief that k3 interprets each of these functions to some intermediate form only once, and executes the intermediate form repeatedly. Kona interprets each function from scratch each time it is executed incurring significantly more overhead.

BTW: The "ray-tracer" also explores some of the differences between kona and k3. The app works in kona only in revised form (see Kray.k vs Nray.k at https://github.com/tavmem/nsl )