Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Let's use entity_load again and make it "configurable".
Comment | File | Size | Author |
---|---|---|---|
#19 | followup.patch | 2.7 KB | bojanz |
#18 | followup.patch | 1.78 KB | bojanz |
#16 | 1002744.patch | 10.15 KB | bojanz |
#15 | 1002744.patch | 10.16 KB | bojanz |
#14 | 1002744.patch | 9.7 KB | bojanz |
Comments
Comment #1
dawehnerThis code does currently not remove the pre_render slime.
Comment #2
bojanz CreditAttribution: bojanz commentedQuoting myself from the prequel issue (#936196: Don't use entity_load to display fields):
So, we now need benchmarks! Any volunteers? Would allow dereine & me to focus on some more coding...
Comment #3
bendiy CreditAttribution: bendiy commentedAny particular method for benchmarks you would suggest? Are render times from the Dev module good enough?
Comment #4
bradezone CreditAttribution: bradezone commentedsubbin'
Comment #5
alex_b CreditAttribution: alex_b commentedsub
Comment #6
catchSubscribing.
I'm not sure you'll see a lot with devel timings (although memory usage would be useful), worth posting though.
The ideal thing here would be to set up a view, then profile using xhprof with and without the entity load setting (do this a couple of times each side to rule out other caching). You can then see the overall change in time/cpu/memory and how much in absolute time/percentage entity_load() takes (since that ought to be the only variable between the two requests).
Would also make sense to profile with a view that specifically includes and renders the node body as a field, since that should show the difference with and without the check_markup() caching discussed in other issue.
Comment #7
das-peter CreditAttribution: das-peter commentedSubscribing.
Comment #8
das-peter CreditAttribution: das-peter commentedLooked into the patch, since I try to handle this issue #1006176: Add support for field based translation.
Current patch seems not to solve the issue since we still have JOINS to the field tables.
As far as I understand the JOIN is used to determine the entity_type of the field - couldn't this also be done by checking the base_table of the view or the relation that's used for the field?
Comment #9
bojanz CreditAttribution: bojanz commentedOkay, so we agreed that we need entity_load() and we need it quickly, regardless of benchmarks. It has no sane alternative.
We also agreed that contrib modules like sphinx don't need our pre_render() frankenstein, just the fields in the query itself. This makes the patch smaller & easier to understand.
However, grouping support landed, so we need to make sure that one still works as it should.
Here's an in progress patch. It actually doesn't work for some reason (entity_id for one field is NULL, breaking everything...), but I'm too tired to debug it further.
Also not sure if the entity_type hack (calculate it ourselves and add it to the query instead of adding the column itself) is sane, or if it even helps grouping.
And if we could get the entity_id without joining on the field table, that would eliminate the whole join... However, it's not as easy as fetching the base id, since the field could be under a relationship...
Comment #10
dawehnerWhat happens if we groupby, does this still work?
Comment #11
febbraro CreditAttribution: febbraro commentedsub
Comment #12
bojanz CreditAttribution: bojanz commentedIt's not working because
Needs to be:
That's why I shouldn't post patches that late.
Comment #13
bojanz CreditAttribution: bojanz commentedLet's try this one.
Comment #14
bojanz CreditAttribution: bojanz commentedThe last patch contained a few hunks too many.
dereine has confirmed on IRC that the code is working.
I'm working on eliminating the join completely by default, but I guess the current patch can be committed if it becomes urgent...
Comment #15
bojanz CreditAttribution: bojanz commentedOkay, so the join is added only if "add field to query" is TRUE, or we are using grouping, or there's a filter / sort.
Smells like final version.
Comment #16
bojanz CreditAttribution: bojanz commentedNow with 100% less prefixes.
Comment #17
dawehnerHuge kudos for bojanz
Thanks for this big effort let's hope it has an end!
Comment #18
bojanz CreditAttribution: bojanz commentedLet's just tweak it a bit :)
Comment #19
bojanz CreditAttribution: bojanz commentedEven better. Replacing old "object" terminology which is older than the term "entity".
Comment #20
dawehnerThanks!
Commited to 7.x branch.
Comment #22
kevinob11 CreditAttribution: kevinob11 commentedNot seeing where the "Add Fields to Query" option is...
Comment #23
dawehnerIt's an option in the code.
You have to use hook_views_data_alter to add this.
Comment #24
kevinob11 CreditAttribution: kevinob11 commentedI see, that makes sense thanks. I would rather do it in code anyway.