23 votes

How can I make kint() load faster when debugging twig templates?

There are two other ways other users have mentioned for setting the max output levels in addition to the settings.php method mentioned in the question, plus a couple other ideas below: Create a /...
chrisshattuck's user avatar
17 votes
Accepted

Field Collection vs. Paragraphs

In many respects the Paragraphs module appears to be a fork of Field Collection. Functionally, the difference between the modules lies in how their respective field widgets operate. The Field ...
Adrian Cid Almaguer's user avatar
13 votes
Accepted

Difference between drupal_static and \Drupal::state?

They perform different tasks. drupal_static() only stores data for the current page load (or ajax load). For example, if you are loading something from a database table multiple times on a single page ...
Jaypan's user avatar
  • 17.4k
8 votes

How can I make kint() load faster when debugging twig templates?

Kint is not the only library that you can use for debbuging variables and twig templates. I suggest to use Symfony var-dumper that IMHO is one of the most powerful lib for debuging variables. Symfony ...
marco's user avatar
  • 1,226
8 votes

Difference between drupal_static and \Drupal::state?

drupal_static() is used to cache data within a single page request. it stores the data in a static variable. The class returned by \Drupal::state() handles values that need to be preserved between ...
apaderno's user avatar
  • 97.3k
7 votes
Accepted

What is the fastest way to get node title from nid?

You said fastest. If you can compromise two things, this should be the fastest one. Now, note that you have to compromise: If you are only trying to get the node title, and if you are sure that ...
AKS's user avatar
  • 9,514
7 votes

How can I make kint() load faster when debugging twig templates?

FYI, as of Devel v3, you'll need to make two updates if you use the top method suggested by @chrisshattuck Go to admin/config/development/devel?q=/admin/config/development/devel Make sure "Kint" is ...
mrsflinger's user avatar
7 votes
Accepted

How to modify .htaccess to serve brotli compressed static assets over gziped ones?

Give this a try # Rules to correctly serve gzip compressed CSS and JS files. # Requires both mod_rewrite and mod_headers to be enabled. <IfModule mod_headers.c> # Serve brotli compressed CSS ...
mikeytown2's user avatar
  • 8,312
7 votes
Accepted

Microkernel with low bootstrap level?

A lot of the bootstrap process happens now implicitly as services are requested. If nothing requests the database service then Drupal won't open the connection to it and so on. The minimal amount of ...
Berdir's user avatar
  • 83.1k
7 votes
Accepted

Why does loadMultiple load 1000 nodes 9.2 times faster than loading each node one by one?

It's likely that when you are loading individual nodes, you are loading the entity type manager, then for each node retrieve the storage, do a query to get the node data, and build the node. With the ...
Jaypan's user avatar
  • 17.4k
6 votes

Which method has better performance

This is essentially impossible to answer. You have one part of your question, wrong Your first method uses a single node_load_multiple() with multiple node_save Your second answer uses multiple ...
mpdonadio's user avatar
  • 38.1k
6 votes

Difference between drupal_static and \Drupal::state?

When you want to store hard to compute data in memory you use a static variable. But to store this data in the database the State API is not the right place, despite the similar name: The State API ...
4uk4's user avatar
  • 99.2k
6 votes

Data coming from entityTypeManager->getStorage is cached data?

load() and loadMultiple() are cached, loadByProperties() is a shortcut for an entity query + load, the entity query is not cached. Do not use loadByProperties() if you know the entity ID.
Berdir's user avatar
  • 83.1k
6 votes
Accepted

Performance is notoriously slow

It appears Azure's docker container services, which App Services leverages, is the cause of the problem. Two big pains with Azure's app service (as explained by Azure support): First, the docker ...
David Lozzi's user avatar
6 votes
Accepted

How do I set the height and width for images that use a responsive images style?

The code for this is actually pretty simple. There are a few important points. For this to work, all of the responsive images in a single responsive image style must have the same aspect ratio. They ...
Patrick Kenny's user avatar
6 votes
Accepted

Is it helpful to improve performance by mysql table indexing?

The cache_default table already has an index by CID (as well as indexes by creation and expiry date that allow old entries to be discarded). Since almost all queries to the table are by CID there's ...
Alfred Armstrong's user avatar
5 votes

What is the fastest way to get node title from nid?

Use node_load_multiple to get nodes with your set of nids. From the documentation page: This function should be used whenever you need to load more than one node from the database. Nodes are ...
Manikandan's user avatar
5 votes
Accepted

Leverage browser caching issue

Read this article about Leverage Browser Caching for Images, CSS and JS. Add these lines to your .htacess file. ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType ...
Yuseferi's user avatar
  • 22k
5 votes
Accepted

Debugging "UNCACHEABLE" header

This was a good debug deep dive. As mentioned by 4k4 the problem is the first addCacheableDependency line. Instead of passing the host entity itself, I was mistakenly passing the object returned from ...
Kevin's user avatar
  • 27.8k
4 votes

Is using nodes for a notification system a performance concern?

I would go with Messaging. Dedicated Entity (if implement properly) is always faster than Node. I participated in the big D7 project and we were happy with Message API. By using a custom entity you ...
Codium's user avatar
  • 4,955
4 votes

Should we use a separated database for our data set?

Talk to your hosting provider. If they can't answer these questions, get a new hosting provider. These really are concerns you should bring to your hosting provider. A quality hosting provider will ...
nvahalik's user avatar
  • 3,622
4 votes
Accepted

Archive old content data in different database

Here's what you can do: Add your archive database to your settings.php below your default database. $databases['my_other_db']['default'] = array( // Your secondary database's credentials here. //...
Patrick Scheffer's user avatar
4 votes
Accepted

Loose compression for all images directly from Drupal

You're looking for this but in D8 - https://www.drupal.org/project/imageapi_optimize. You can still use the tools to do it manually. PNG - Use https://pngquant.org/ first with these settings --speed=...
mikeytown2's user avatar
  • 8,312
4 votes
Accepted

Functional tests performance

Do not use standard (as you said in a comment). Use testing and then create only what you need in the test. That's the main thing to speed up your tests. They are still rather slow, but that should ...
Berdir's user avatar
  • 83.1k
4 votes

Is there a way to minify HTML?

Use spaceless tag. This will not minify the HTML, instead avoids extra whitespace between HTML tags to avoid browser rendering quirks. When cached, can serve better. In html.html.twig {% spaceless %}...
echo's user avatar
  • 1,489
4 votes

Why /Drupal\Core\Form\FormBuilder->renderPlaceholderFormAction is taking so long?

Pretty sure that report is bogus. That's just an arbitrary method, not a controller. They somehow identify that as the controller for that request but of course that doesn't make sense. That page ...
Berdir's user avatar
  • 83.1k
4 votes

Should one avoid lots of use statements in a custom modules .module file?

The use statements alone are definitely not going to be a performance concern. I doubt that we're even talking about nanoseconds here. So that really doesn't matter. I'm guessing that this is resolved ...
Berdir's user avatar
  • 83.1k
4 votes

How to delete nodes without taking a lot of time?

Usually I use 2 approach from the command line. If you call a page from the browser to accomplish the task this will use more time and resources. 1. You can create your own module named drush_delete ...
Adrian Cid Almaguer's user avatar
4 votes

How to achieve clean HTML markup?

A lot of those classes are added by the classy base theme templates. You'll be able to get rid of them with a theme based on stable instead.
Charlie Bamford's user avatar
3 votes
Accepted

Save Nodes with Field collection in a different database

Try this, it was working for me: $nid = '2841'; $item_ids = array(); $node = entity_load('node', array($nid), array(), true); foreach ($node[$nid]->field_COLLECTION_NAME[LANGUAGE_NONE] as $key =&...
GwenM's user avatar
  • 684

Only top scored, non community-wiki answers of a minimum length are eligible