During performance profiling of Page Editor I’ve noticed that the “My Items” button was taking a lot of CPU time to render. was very kind to tell me that with no hesitation.

If you don’t know what I am talking about, this “My Items” button shows the number of items locked by the context user:

and basically runs the following query:

Database.SelectItems("fast://*[@__lock='%\"" + Context.User.Name + "\"%']");

Since I was running on a fairly large customer database, this was quite expensive, specifically, taking more than 200ms.

One of my colleagues helped me discover that this behavior actually depends on the following setting which is not defined in web.config by default: “WebEdit.ShowNumberOfLockedItemsOnButton” and thus defaults to “true” always.

So in order to avoid such overhead on every Ribbon.Render, simply introduce this setting in web.config (even better in auto-include config file) and set it to “false”:

<setting name="WebEdit.ShowNumberOfLockedItemsOnButton" value="false" /> 

This should definitely speed things up for everyone in Page Editor.
image