Skip to content

Conversation

kerams
Copy link
Contributor

@kerams kerams commented May 12, 2025

No description provided.

let inline appendOne (v: 'v) (arr: 'v array) =
let res = Array.zeroCreate(arr.Length + 1)
res[.. arr.Length - 1] <- arr
arr.CopyTo (res.AsSpan ())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is several times faster.

type private Part<'v> =
| Empty
| Filled of struct (Items<'v> * Part<'v>)
| Filled of Items<'v> * Part<'v>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes indirection.

Comment on lines -261 to +262
| Few of data: struct (Size * 'v * 'v * 'v)
| Many of arr: 'v array
| Few of data: Size * 'v * 'v * 'v
Copy link
Contributor Author

@kerams kerams May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes indirection and decreases total DU struct size with some type parameters (48 to 40 bytes for string).


| Added of value: uint16
| Removed of value: uint16
| Changed of value: uint16
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merges fields and reduces struct size from 12 to 8 bytes.

@edgarfgp
Copy link
Member

Thanks @kerams

@edgarfgp edgarfgp merged commit ae87b8e into fabulous-dev:main May 12, 2025
1 check passed
@kerams kerams deleted the opt branch May 12, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants