-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does this library need so much memory? #184
Comments
I guess it needs more memory because each field instantiates a ViewComponent instead of calling a simple helper, but maybe there's more overhead than needed? Would love to see some more benchmarks. Also, maybe we could provide some kind of "light mode" where some fields are rendered using the regular helpers and other with ViewComponents? In my projects, we usually override some fields but not all: the most basic ones ( |
@Spone You're probably right regarding our app. We've pretty much subclassed all form components and added mostly Tailwind classes via the Edit: There's two other performance tasks included in that commit as well, Edit2: I feel like since everyone who's following the README, generating the |
Unfortunately I don't have an answer for you, but I have a simple testcase at rubiii/benchmark_vcf
There's only one commit to create the minimal Rails app and then this commit adding
ViewComponent::Form
, some performance benchmark tasks, benchmark libraries and a simple view.Running the
benchmark:memory
task in production env, yields the following results:I'm not sure how or how much I can help with this. I could implement some performance benchmarks for you like the
ViewComponent
library recently did as a starting point to improve the situation maybe? Let me know what you think.For reference: We have a rather complex
ViewComponent
rendering several other components which all render some form elements usingViewComponent::Form
. We benchmarked memory usage rendering this component with and withoutViewComponent::Form
.It comes down to
460.094k memsize, 460.094 allocated
withoutViewComponent::Form
and8.906M memsize, 8.905.693 allocated
withViewComponent::Form
. That's19.36x more
according to the benchmark.The text was updated successfully, but these errors were encountered: