Skip to content

Exec-next: legacy instance methods#5571

Merged
rmosolgo merged 13 commits intomasterfrom
exec-next-legacy-instance-method
Mar 9, 2026
Merged

Exec-next: legacy instance methods#5571
rmosolgo merged 13 commits intomasterfrom
exec-next-legacy-instance-method

Conversation

@rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Mar 9, 2026

All the necessary work is already here to support legacy instance methods, it just needs to be prettied up.

TODO:

  • Out of curiosity, benchmark it. I suspect that execute_next with resolve_legacy_instance_method: true is still faster than .execute.
  • Document this new option
  • Make sure docs clearly state that the implicit default behavior has changed.
  • Support legacy implicit default? No, but it can be hard coded.

Benchmark results

In the "large benchmark" in this gem (a basic loop over 1000 objects), using legacy_instance_method adds an allocation per object and, in that example, it's 10% slower than using hash_key:

Comparison:
         exec_next hash_key:      211.2 i/s
    exec_next legacy_method:      193.2 i/s - 1.09x  slower
    
       legacy_exec hash_key:       14.7 i/s - 14.33x  slower

They're both 14x faster than legacy execution 😬

Memory:

Hash Key:      Total allocated: 1244256 bytes (4455 objects)
Legacy Method: Total allocated: 1292296 bytes (5456 objects)

1001 more objects: one array and 1000 GraphQL object type instances.

@rmosolgo rmosolgo added this to the 2.5.21 milestone Mar 9, 2026
@rmosolgo rmosolgo changed the base branch from master to exec-next-guides March 9, 2026 14:37
Base automatically changed from exec-next-guides to master March 9, 2026 14:47
@rmosolgo rmosolgo merged commit ba7242c into master Mar 9, 2026
13 checks passed
@rmosolgo rmosolgo deleted the exec-next-legacy-instance-method branch March 9, 2026 20:23
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.

1 participant