-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List, array comprehension implementation #10532
Comments
Off the top of my head I can't see a reason why they would require emitting with a sequence, but I'm not sure which code is responsible for that (perhaps iLXGen?). Marking it as an improvement for now |
One of the goals of the resumable code rfc is (edit: enabling) faster list/array/seq builders |
|
Yay |
Actually was done in #11592 |
List and array comprehensions appear to be implemented in terms of sequence computation expressions. Is there a specific reason why individual items aren't generated into
ResizeArray
, which would then be converted into the required collection?For arrays, the benchmark is a landslide in favor of the latter approach. Lists would allocate a bit more in the end, but be around twice as fast given a reasonable amount of elements (I don't suppose list is the right choice for 100k elements, whatever the use case).
Going even further, with ranges like above, the item count is known in advance, so one could allocate an array of exactly the right size and feed items into that.
The text was updated successfully, but these errors were encountered: