summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2023-12-18 09:59:06 +0100
committerJean Boussier <[email protected]>2023-12-18 10:33:18 +0100
commitba1d1522d35a7dd2595603ead57cd0fa8b21ba8b (patch)
tree5ed31403888cc8d733db3810c2d09b7238e22d7b /shape.c
parente8064c6c2c317be78953b4d19226368580af0dca (diff)
Make the SHAPE_TOO_COMPLEX performance warning more actionable
As suggested by Mame, we should try to help users fix the issues without having to lookup the meaning of the warning.
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/shape.c b/shape.c
index 2d5c2109c7..c78a02a1cb 100644
--- a/shape.c
+++ b/shape.c
@@ -733,9 +733,10 @@ rb_shape_get_next(rb_shape_t *shape, VALUE obj, ID id)
if (RCLASS_EXT(klass)->variation_count >= SHAPE_MAX_VARIATIONS) {
rb_category_warn(
RB_WARN_CATEGORY_PERFORMANCE,
- "Maximum shapes variations (%d) reached by %"PRIsVALUE", instance variables accesses will be slower.",
- SHAPE_MAX_VARIATIONS,
- rb_class_path(klass)
+ "The class %"PRIsVALUE" reached %d shape variations, instance variables accesses will be slower and memory usage increased.\n"
+ "It is recommended to define instance variable in a consistent order, for instance by eagerly defining them all in the `initialize` method.",
+ rb_class_path(klass),
+ SHAPE_MAX_VARIATIONS
);
}
}