Skip to content

Conversation

@rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Jan 6, 2026

I was hoping that this would play nicer with ruby-lsp. It's better but still not amazing:

Before After
Screenshot 2026-01-06 at 7 21 13 AM Screenshot 2026-01-06 at 9 26 25 AM

It's a wall of text, but the docs are there, and if you click to jump to definition, you can read them in original formatting in the gem source.

  • Copy docs from Field#initialize to HasFields#field, add tests
  • Copy docs from Argument#initialize to HasArguments#argument, add tests
  • Check performance impact on schema boot -- this could change how Hashes are allocated during schema definition
  • Consider removing Field.from_options?

Fixes #3543 ... almost 5 years later 😞

I'm also interested in exploring other documentation methods if they would play nicer with LSP support.

@rmosolgo
Copy link
Owner Author

rmosolgo commented Jan 7, 2026

Using be rake bench:profile_boot, it looks like the code currently allocates way more memory, but way less objects:

- Total allocated: 8242456 bytes (51658 objects)
+ Total allocated: 12990408 bytes (44849 objects)

My guess is that this is Ruby handling all these big keyword argument lists ... time to investigate!

@rmosolgo
Copy link
Owner Author

rmosolgo commented Jan 9, 2026

I extracted the Field.from_options change into another PR and reverted my changes to the keyword parameters of these methods because of the memory overhead. But I kept the docs and tests on the docs. In the end, it turned out to use less memory, probably because of removing *args:

- Total allocated: 7770688 bytes (46971 objects)
+ Total allocated: 7685808 bytes (44849 objects)

@rmosolgo rmosolgo merged commit 215e7fa into master Jan 9, 2026
13 checks passed
@rmosolgo rmosolgo added this to the 2.5.17 milestone Jan 9, 2026
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