Platform 2018.11.15
On production sites
This release adds two ways to measure how fast your code runs. Both came from community requests.
Time anything with time_diff
The time_diff filter returns the difference between two times. Use it to count the days until an event (unit d), the minutes before you must leave (unit m), or exactly how long a piece of code took (unit ms, the default). Seconds work too (unit s). Take a time with 'now' | to_time before and after the code, then pass both to time_diff. You can use it anywhere Liquid is allowed, such as partials and callbacks. To time a GraphQL query, put it between your start and stop times.
Write the result to your logs with the log tag and read it with insites-cli logs.
Find slow code with the page profiler
Add enable_profiler: true to a page. Each request to that page then adds two log entries you can read with insites-cli logs: one for the page and one for its layout. They show which parts of your Liquid take the most time. To reduce noise, the log only includes entries that took longer than 10 ms.
Try not to profile a page on production, because it can slow the site down. If you must, turn the profiler off right after you make the request.