Hi all, I have a big site on a not so good server machine.
Now I need to create (and display) a block with the last entry of a particular node type (call it "foo").
I can do this in 2 ways: - views (with template files) - custom module with costum block section
In a performance context which is the best solution ? I use views in the site so this will not be the only view, and I use other custom modules so the block section will be part of one of them.
Tnx.
M.
In a performance context, custom module block will be the best solution as per my understanding. Because you are not storing your block code in the database in that case. It is always good not to store code in the database so if you are creating a view [which is easy to implement but not recommended for performance point of view] then it will store the code in the database.
On Wed, May 26, 2010 at 7:45 PM, Michel Morelli michel@ziobuddalabs.itwrote:
Hi all, I have a big site on a not so good server machine.
Now I need to create (and display) a block with the last entry of a particular node type (call it "foo").
I can do this in 2 ways:
- views (with template files)
- custom module with costum block section
In a performance context which is the best solution ? I use views in the site so this will not be the only view, and I use other custom modules so the block section will be part of one of them.
Tnx.
M.
-- Michel 'ZioBudda' Morelli michel@ziobuddalabs.it Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660
http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ziodrupal.net MSN: michel@ziobuddalabs.it JABBER: michel@ziobuddalabs.it
-- [ Drupal support list | http://lists.drupal.org/ ]
Amit Vyas wrote:
In a performance context, custom module block will be the best solution as per my understanding. Because you are not storing your block code in the database in that case. It is always good not to store code in the database so if you are creating a view [which is easy to implement but not recommended for performance point of view] then it will store the code in the database.
That is a SWAG if I ever heard one. The chances of the view being slower than code stored in a file on disk is plus or minus 50 percent. The extra hit on the DB for the view is minimized because of caching.
Adding additional modules also adds some overhead though. You got the PHP parsing having to run through that file (helped some with op-code caching), as well as another hook_block to call and process in this case. So I would say the performance difference between the two scenarios would be hardly noticeable. In this case, where views is already used, sticking with views would give the added benefit of less code to maintain also.
Basically if they weren't already using views, I would suggest going the custom module route; Views would be overkill for such a simple purpose. Since they are already using views though, go ahead and utilize it and make life a little simpler.
Jamie Holly http://www.intoxination.net http://www.hollyit.net
On 5/26/2010 10:28 AM, Amit Vyas wrote:
In a performance context, custom module block will be the best solution as per my understanding. Because you are not storing your block code in the database in that case. It is always good not to store code in the database so if you are creating a view [which is easy to implement but not recommended for performance point of view] then it will store the code in the database.
On Wed, May 26, 2010 at 7:45 PM, Michel Morelli <michel@ziobuddalabs.it mailto:michel@ziobuddalabs.it> wrote:
Hi all, I have a big site on a not so good server machine. Now I need to create (and display) a block with the last entry of a particular node type (call it "foo"). I can do this in 2 ways: - views (with template files) - custom module with costum block section In a performance context which is the best solution ? I use views in the site so this will not be the only view, and I use other custom modules so the block section will be part of one of them. Tnx. M. -- Michel 'ZioBudda' Morelli michel@ziobuddalabs.it <mailto:michel@ziobuddalabs.it> Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660 http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ziodrupal.net MSN: michel@ziobuddalabs.it <mailto:michel@ziobuddalabs.it> JABBER: michel@ziobuddalabs.it <mailto:michel@ziobuddalabs.it> -- [ Drupal support list | http://lists.drupal.org/ ]-- Regards, Amit Vyas
Email : amit.vyas@blisstering.com mailto:amit.vyas@blisstering.com Mobile : +91 993-040-1490 Skype : vyasamit2004 Twitter : amit_vyas
Michel Morelli wrote:
Hi all, I have a big site on a not so good server machine.
Now I need to create (and display) a block with the last entry of a particular node type (call it "foo").
I can do this in 2 ways:
- views (with template files)
- custom module with costum block section
In a performance context which is the best solution ?
You'll probably have to test it yourself with your environment to determine the performance thing.
I use views in the site so this will not be the only view, and I use other custom modules so the block section will be part of one of them.
Just because you have views already installed I would suggest using a view for the block because it is less code to maintain.
I would go with views since you're already using it. The other thing is that you can use views caching to keep the server load even lower on that block.
Jamie Holly http://www.intoxination.net http://www.hollyit.net
On 5/26/2010 10:15 AM, Michel Morelli wrote:
Hi all, I have a big site on a not so good server machine.
Now I need to create (and display) a block with the last entry of a particular node type (call it "foo").
I can do this in 2 ways:
- views (with template files)
- custom module with costum block section
In a performance context which is the best solution ? I use views in the site so this will not be the only view, and I use other custom modules so the block section will be part of one of them.
Tnx.
M.