CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: setinterval

Batch remove

To add items to a list in bulk, or remove them in bulk. Well to do that you can use SPLinq, Server Object Model and … web.ProcessBatchData, which is the most effective.

I did an experiment today. I created 1000 tasks in my task list three times and removed all items in three different ways and took time.

First I put 1000 items with ajax and listdata.svc:

function pad(n) {
   if (n >= 10000) return n;
   if (n >= 1000) return '0' + n;
   if (n >= 100) return '00' + n;
   if (n >= 10) return '000' + n;
   return '0000' + n;
var s;
var counter = 0;
var title = "task "
function foo() {
   if (counter > 10000) {
   else {
      var value = {};
      value.title = title + pad(counter);
s = setInterval(foo, 200);

Then I ran three different scenarios. Here is the resut for VMWare machine Windows Server 2008 R2, 4GB RAM, SharePoint 2010 SP1:

1000 items 10 000 items 20 000 items
Batch 00h:00m:28s.950ms (29s) 00h:04m:20s.730ms (261s) 00h:08m:35s.260ms (515s)
Object Model 00h:01m:37s.860ms (98s) 00h:16m:40s.770ms (1001s) 00h:33m:50s.250ms (2030s)
SPLinq 00h:02m:24s.070ms (144s) 02h:17m:02s.570ms (8223s) 11h:51m:08s.130ms (42668s)

This result confirms another comparision. See even advantages and disadvantages of linq2sp vs caml.

The time includes even the instantiation of the SPSite and SPWeb objects and getting of task ids to remove, this to get a fair comparision with SPLinq, where this instantiation is implicit (within the context).

Average time for removing one list item:
1000 items 10 000 items 20 000 items
Batch 29.0ms 26.2ms 25.8ms
Object Model 97.9ms 100.1ms 101.5ms
SPLinq 144.1ms 822.3ms 2133.4ms

Some curious facts:
1. SPLinq method left one list item after removing 10 000 batch (task 08787) and three items while removing 20 000 batch (task 07550, task 12042, task 19663). Why?

2. I opened the list sometimes and I found that deleting of items took very long time in the beginning, and then it became faster and faster. I suppose the whole data context was saved after every submission. I am wondering if it would  be different if I’d set ObjectTrackingEnabled to false, which is true by default.

See the whole blog entry for the code I ran to compare these three ways to remove list items.

Read more of this post

Daniel Chronlund Cloud Tech Blog

News, tips and thoughts for Microsoft cloud fans

Вула Чăвашла

VulaCV - Чăвашла вулаттаракан сайт

Discovering SharePoint

And going crazy doing it

Bram de Jager - Architect, Speaker, Author

Microsoft 365, SharePoint and Azure

SharePoint Dragons

Nikander & Margriet on SharePoint

Mai Omar Desouki

PFE @ Microsoft

Cameron Dwyer

Office 365, SharePoint, Azure, OnePlace Solutions & Life's Other Little Wonders


Me and My doings!

Share SharePoint Points !

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

Aryan Nava

DevOps, Cloud and Blockchain Consultant


SharePoint for everyone


Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint


Mostly what I know and share about...