This is an automated archive.
The original was posted on /r/php by /u/P4nni on 2023-08-24 20:34:45+00:00.
Consider the following example: Using an event dispatcher (based on PSR-14) requires every event to be represented by an object. An application will create and dispatch around 500 unique events. Thus around 500 event classes (and files) are required. For example: UserCreateEvent, UserLoginEvent, UserLogoutEvent, PasswordChangedEvent, and so on. Most of the classes will be very small as the Events are just data objects.
Does introducing that many classes affect the performance of the application and/or system in the following ways:
- Will all 500 classes be read from disk and interpreted on every request?
- Will all 500 classes be kept in RAM?
- Will the (Composer) autoloader be slowed down by “polluting” it with that many classes?
If any of these concers are true, are they valid concerns or neglibible? Are there any benchmarks about this topic? Are there any other concerns to take into account?