Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/12/2019 in all areas

  1. In an effort to hopefully provide some clarity to this thread, I'll try to shed some light on the performance aspects of the use of the function function, versus a quoted lambda expression, versus other alternatives. There is indeed a verifiable performance improvement to be gained through the use of the function function over a quoted lambda expression when supplied as a functional argument for, say, a mapcar expression. However, this improvement is only realised when the code is compiled to an optimised VLX application. The reason for this improvement is actually rather straightforward: when a VLX application is optimised, function evaluation is 'direct', meaning the interpreter no longer needs to evaluate the symbol which points to the function definition in order to evaluate the expression (i.e. the code behaves as if the function definition had been inserted in-line in place of the symbol referencing such function). As such, when the function function is used, functional arguments can be similarly linked and optimised as the VLX compiler can identify the occurrence of the function (albeit still an anonymous function) ahead of time, and hence optimise evaluation of the expression in the same manner as a named function. Conversely, when an anonymous function is quoted (or equivalently, when a defun-q expression is expressed as a quoted literal), such expressions can only be evaluated during run-time and hence cannot be linked & optimised in the manner described above.
    1 point
×
×
  • Create New...