base: growable_array#6411
Draft
michaellilltokiwa wants to merge 2 commits intotokiwa-software:mainfrom
Draft
Conversation
old:
/home/not_synced/flang_dev/fzweb (main)130$ /home/sam/openvscode-server-fuzion/vscode-fuzion/fuzion/build/bin/fz -jvm -JLibraries="wolfssl sodium" -modules=http,lock_free,uuid,mail,wolfssl,crypto,sodium,nom,web -sourceDirs=src,benchmarks benchmarks
session_document.get_content tutorial iter/s: 13.0
session_document.get_content news iter/s: 13.9
session_document.get_content . iter/s: 112.4
Session.event_msg tutorial iter/s: 13.8
Session.event_msg news iter/s: 13.9
Session.event_msg . iter/s: 98.5
new:
/home/not_synced/flang_dev/fzweb (main)$ /home/sam/openvscode-server-fuzion/vscode-fuzion/fuzion/build/bin/fz -jvm -JLibraries="wolfssl sodium" -modules=http,lock_free,uuid,mail,wolfssl,crypto,sodium,nom,web -sourceDirs=src,benchmarks benchmarks
session_document.get_content tutorial iter/s: 15.8
session_document.get_content news iter/s: 16.4
session_document.get_content . iter/s: 149.0
Session.event_msg tutorial iter/s: 16.4
Session.event_msg news iter/s: 15.7
Session.event_msg . iter/s: 129.0
Member
Author
|
@tokiwa-software/developers Looking for feedback on this: Difference to expanding_array:
|
maxteufel
reviewed
Jan 28, 2026
| else if c2 = 0 | ||
| Sequence.this | ||
| else if c1 < 0 || c2 < 0 || max 1 c1 < c2 then | ||
| else if c1 < 0 || c2 < 0 then |
Collaborator
There was a problem hiding this comment.
you probably want to revert this, as discussed in the office there was a reason for this.
Comment on lines
+40
to
+55
| # growable_array -- an array with a length and a (possible larger) capacity | ||
| # | ||
| # An expanding array is a persistent data structure that has cumulative O(1) | ||
| # performance of adding single elements at its end. | ||
| # | ||
| # WARNING: Due to the high worst-case time for addition, this structure should | ||
| # not be used in situations when adding a single element repeatedly to the same | ||
| # instance of `growable_array`. If the resulting | ||
| # `growable_array`'s length is `l`, this will trigger the worst-case | ||
| # addition time, resulting in cumulative time O(m*l) for adding an element m | ||
| # times. | ||
| # | ||
| # This constructor is for internal use only, to create instance of | ||
| # `growable_array`, use `(growable_array T).type.empty` to create an empty | ||
| # expanding array instance. | ||
| # |
Collaborator
There was a problem hiding this comment.
this is just the same comment copied from expanding_array. what is different?
Comment on lines
+85
to
+98
| # create a new `growable_array` with element i set to v. Grow the array | ||
| # in case i == length. | ||
| # | ||
| # expand is not thread-safe. | ||
| # | ||
| # Complexity: O(1) if no allocation is required, O(length+1) otherwise. | ||
| # | ||
| # Cumulative complexity of adding an element to an empty `growable_array` | ||
| # and repeatedly growing the result `add` by a total of `n` elements is | ||
| # `O(n)`. | ||
| # | ||
| # `add` called repeatedly on the same `growable_array` creates copies | ||
| # of the underlying array data and hence has performance in `O(length)`. | ||
| # |
Comment on lines
+134
to
+136
| # create an expanding_array that consists of all the elements of this Sequence followed | ||
| # by all the elements of s | ||
| # |
Collaborator
There was a problem hiding this comment.
it creates a growable_array, not an expanding_array?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
old:
new:
This is likely mostly due to String.concat being faster.