-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add profiling support #80
Comments
Is that something we are using? Since it doesn't look like we are using the
Do you mean "us" as implementers of the liquid API? Since I believe we use stackprof for profiling our code in production. That will profile rendering with Liquid::C, although it won't show where the time is spent in the C code. For that purpose, we will want a sampling C profiler, which works like stackprof, but gets the C stack trace periodically instead of the ruby stack trace. For development of liquid-c on MacOS, I've added a c_profile rake task that works with Xcode's instruments command (#62).
We should also allow template authors to profile their liquid code. A sampling profile works better for a single tenant use case, where it can be used across renders and capture. If we are just trying to profile a single render, then we may not collect enough samples. If we increase the sampling frequency to collect more samples, then we add more significant overhead. For local development, we render multiple times in a loop to collect enough samples with a sampling profiler, but naturally that redundant rendering is a significant overhead. If we did want to implement a sampling profiler, then we could expose a stack of liquid source locations from the Liquid::Context that could be used by a sampler. Another option would be to add instrumentation instructions to the VM code to collect timing information. That is essentially how the ruby liquid profiler works, however, we could do that more efficiently from C code. We would probably want to expose a different ruby API for it though. |
Yes, through the Theme Inspector that customers are using, and employees too.
Sorry I meant "us" as the team I was working with debugging Liquid issues on a merchant site. But it could be merchants themselves, or theme designers.
Saw this! Very cool.
Yes, this is what I had in mind writing the issue. Template authors are currently optimizing their templates based on Liquid Ruby profilings. |
Ok, sorry that I missed that. We should definitely add support for this in that case. I was concerned that it exposed the liquid parse tree nodes, but it looks like the |
I thought the problem was with liquid-c mostly being disabled when profiling liquid. That happens automatically ( Line 66 in 368792e
I'm not sure what affected the depth of the flamegraph |
Found the issue. It's because section rendering logic doesn't set the |
Right now, only Ruby Liquid has profiling. Profiling Liquid templates in production triggers Ruby Liquid to render the template, not Liquid::C. This is leading us on the wrong paths RE what to optimize.
I need to look at how other VMs are doing profiling with low overhead.
The text was updated successfully, but these errors were encountered: