Optimize list comprehensions and sequence operator #386
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: radrow
At this moment, list comprehensions and the
..
operator compile to calls to an implicitly importedListInternal
namespace. Most importantly, LC performs numerous calls toflat_map
which is not very performant. Instead of that, the compiler should produce code optimizing the number of passes through lists. Especially:[f(x) | x <- l]
could be amap
[x | x <- l, if p(x)]
could be afilter
[f(x) | x <- l, p(x)]
could be a single-pass combination ofmap
andfilter
And so on. We should consider if using inline assembly or functions would work better -- this might be determined by a flag, as there is a clear trade-of here.
Created by: radrow
May be useful: https://www.researchgate.net/profile/Mario-Latendresse/publication/229001057_Simple_and_efficient_compilation_of_list_comprehension_in_Common_Lisp/links/09e4150a68b953e657000000/Simple-and-efficient-compilation-of-list-comprehension-in-Common-Lisp.pdf?origin=publication_detail
Created by: radrow
A loop construct in fcode could help