arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Add `__slots__` to `arcade.View`

Open JackAshwell11 opened this issue 2 years ago • 6 comments

Enhancement request: Add a __slots__ attribute to arcade.View

What should be added/changed?

As talked about in Discord, a __slots__ attribute could be added to arcade.View.

What would it help with?

This will make it easier to specify which attributes belong to a class and should also improve memory performance.

JackAshwell11 avatar May 02 '23 19:05 JackAshwell11

I'm not sure of the value of adding slots to views as it may create problems with mix-ins. It could interfere with possible future work on bringing the UI stack, views, and sections into closer alignment.

pushfoo avatar May 06 '23 07:05 pushfoo

I'm not sure of a clear benefit here. Do we have games where there are so many views we need slots?

pvcraven avatar May 06 '23 21:05 pvcraven

@Aspect1103 do you have a scenario where this would be helpful?

gran4 avatar Jun 03 '23 07:06 gran4

@Aspect1103 do you have a scenario where this would be helpful?

I thought this was discussed in Discord. It would improve memory performance but would create too many other problems for it to be worth it.

JackAshwell11 avatar Jun 03 '23 08:06 JackAshwell11

I thought this was discussed in Discord.

I think we need to get better at posting discussion summaries & links back to discord in issues.

It would improve memory performance but would create too many other problems for it to be worth it.

This may be a goal for 3.1 or 4.0, but switching to protocol types for some of our major types may render this a moot issue. It needs further investigation since it comes with downsides such as complicating or eliminating use of isinstance.

pushfoo avatar Jun 04 '23 01:06 pushfoo

Setting this to Future. Looking at the suggeted PR it doesn't seem like this was a good idea after all. Going down the protocol path might be a better way. I don't think we should mess with this before 3.0 release. We are already very late for this release.

einarf avatar Jun 09 '23 01:06 einarf

See closed pull request

einarf avatar Jul 12 '24 16:07 einarf