3

EDIT: I created a Drupal issue for this: https://www.drupal.org/node/2846485


In D8, I have a content type "Event" with a multi-value DateRange field called "Date". I have one single event node, and this event node has 100 values for the date range field (1 daterange value per day for 100 days).

I've created a view that outputs a row for each occurrence of the event. I accomplished this by having the view output Fields, and added the "Title" and "Date" field. For the "Date" field configuration, I have it set so that it will render a row for each value of the field, so 100 rows end up being returned like this:

enter image description here

Without render caching enabled, it takes 20 seconds for the results to render. With render caching enabled, and the cache primed, it takes 0.5 seconds.

With the cache disabled, I would expect it to take a bit longer, but not 40 times longer. The reason I'm testing with the cache disabled is that I don't want my site to be taken down after a cache clear, especially since this view will eventually be on the homepage (although with the result set limited a bit). So I'm interested in doing whatever I can to speed up initial rendering of these items.

I used BlackFire profiler to figure out what's going on. It revealed that DateRangePlainFormatter::buildDate is called 20,000 times and took 15 seconds of the total 20 second time:

enter image description here

I can sort of figure out the 20,000 number. There are 100 rows output, one for each date occurrence. Then for each row, views must be trying to render all 100 dates AGAIN. And all that happens twice I guess for some reason?

Ideally views would only call out to render the date fields 100 times, one for each date that's output. I would even settle for 200 times, but 20,000 seems like a bug somewhere.

It looks like I'm going to be spending a lot of time looking deep into views rendering, but hopefully someone can save me some time!

Can anyone point me in the right direction on how to solve this?

closed as off-topic by mpdonadio Jan 24 '17 at 21:30

  • This question does not appear to be about Drupal within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Open an issue in the datetime.module about this. It is def a bug report. – mpdonadio Jan 24 '17 at 21:29
  • I'm voting to close this question as off-topic because it is a bug report that belong in the Drupal issue queue. – mpdonadio Jan 24 '17 at 21:30
  • Ok, I'll do that. I was on fence about that in the beginning – Brian Jan 24 '17 at 22:03
  • When you make the issue, also post where time is spent inside formatDate if you can (i.e., other calls). Pretty sure the developers will want to know that. :) – mpdonadio Jan 24 '17 at 23:12
  • Updated question with a link to the issue. Also included some more details – Brian Jan 25 '17 at 0:43

Browse other questions tagged or ask your own question.