Performance

From APL Wiki
Revision as of 11:35, 19 February 2020 by Matt (talk | contribs)
Jump to navigation Jump to search

As an interpreted language, some have lambasted APL as unreasonably slow compared to other languages. However, much work has been done to ensure that interpreted code from a typical user is reasonably performant. Since its first implementation, work has been done on compiling APL.

Performant usage

For the user, there are a few strategies to consider for reasonable performance.

Mechanical sympathy

Internally, APL arrays are stored as two lists in memory. The first is a list of the shape (although some implementations also include the "stride"[1]). The second is the ravel of elements in the array. Nested arrays consist of pointers to arrays which may be distributed across memory, their use can lead to very inefficient memory read patterns - in contrast to flat arrays which are stored as a contiguous block. This idea is also explored in the study of inverted tables[2].

Performant implementation

For now enjoy a list of references.

Interpreters

Writing

Roger Hui; In Praise of Magic Functions; Dyalog Blog

Video

Morten Kromberg, Roger Hui; Primitive Performance; Dyalog '13 User Meeting

Compilers

- Snake Island Research

References

  1. Nick Nickolov Compiling APL to JavaScript (Vector Volume 26)
  2. Roger Hui Inverted Tables (Dyalog '18 User Meeting)