I’m developing an open source ColdBox module to help the community build Schema.org schemas for web applications. For those unfamiliar, Schema.org is a collaborative vocabulary standard (initiated by Google, Microsoft, Yahoo, and Yandex) that helps search engines understand webpage content.
The Challenge
My module automatically generates CFCs for every Schema.org object type - 384 CFCs in total representing different schema objects. Most users will only need 3-5 of these CFCs per website, depending on their industry.
Architecture Decision
I’m debating two approaches:
Option 1: Include all CFCs in WireBox (/models/ folder)
Pros:
- Can leverage existing module features like Mementifier
- Clean dependency injection
- Consistent with ColdBox patterns
Cons:
- Potential performance impact from 384+ registered models
- All CFCs mapped even when only a few are needed
Option 2: Keep CFCs outside WireBox
Pros:
- Only instantiate needed CFCs on-demand
- Lighter memory footprint
- Possibly better performance for typical use cases
Cons:
- Need to build redundant code to replicate Mementifier functionality
- Less integration with ColdBox ecosystem
Question
Has anyone experienced performance issues when registering hundreds of CFCs with WireBox? I want to keep this module as lightweight as possible while maintaining good developer experience.
Any insights on WireBox’s behavior with large numbers of registered models would be greatly appreciated!