Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site#list is much slower than Site#lists #2

Open
IndigoCZ opened this issue Dec 6, 2011 · 3 comments
Open

Site#list is much slower than Site#lists #2

IndigoCZ opened this issue Dec 6, 2011 · 3 comments

Comments

@IndigoCZ
Copy link

IndigoCZ commented Dec 6, 2011

The following is very slow(100+ seconds):

c = ActiveSP::Connection.new(...)
my_list=c.root.list(list_title)

The following is very quick (7 seconds):

c = ActiveSP::Connection.new(...)
my_list=nil
c.root.lists.each do |list|
    my_list=list if list.Title==list_title
end

Tested on savon-xaop (0.7.2.7), ruby 1.9.2p180, Sharepoint 2007

@IndigoCZ
Copy link
Author

IndigoCZ commented Dec 7, 2011

I discovered that when using the lists method, the delay kicks in when I first call a method (column name) on an individual item. I ran that call through the profiler:

  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 10.44     2.84      2.84    15175     0.19     0.51  REXML::Parsers::BaseParser#pull
  6.72     4.67      1.83    14293     0.13     3.13  Hash#each
  4.54     5.91      1.24    18870     0.07     0.73  Array#each
  3.60     6.89      0.98    11210     0.09     0.16  String#snakecase
  3.43     7.82      0.94    46752     0.02     0.02  String#==
  3.08     8.66      0.84    39945     0.02     0.40  Class#new
  2.28     9.28      0.62     9683     0.06     0.09  String#map_soap_response
  1.95     9.81      0.53     8756     0.06     0.68  Array#map
  1.84    10.31      0.50     6633     0.08     0.25  Array#include?
  1.62    10.75      0.44     3796     0.12     1.00  REXMLUtilityNode#initialize
  1.43    11.14      0.39    12836     0.03     0.05  REXML::IOSource#empty?
  1.43    11.53      0.39    10145     0.04     0.05  REXML::Text#unnormalize
  1.38    11.91      0.38      151     2.50    64.98  Crack::XML#parse
  1.38    12.28      0.38    44941     0.01     0.01  MatchData#[]
  1.37    12.66      0.37      459     0.81     2.44  Net::HTTPResponse#each_response_header
  1.36    13.03      0.37    23280     0.02     0.02  Kernel.initialize_dup
  1.31    13.38      0.36     9591     0.04     0.06  REXML::IOSource#readline
  1.26    13.73      0.34    12940     0.03     0.03  String#strip_namespace
  1.21    14.06      0.33    13498     0.02     0.04  REXML::IOSource#match
  1.10    14.36      0.30    52268     0.01     0.01  Symbol#==
  1.08    14.65      0.30     7956     0.04     0.07  Net::NTLM::FieldSet#[]

@calamitas
Copy link
Member

The #list method actually returns the list with list_name in the URL, which can be different from the title.

It is kind of annoying that Savon insists on parsing the XML returned by SP with Crack. Crack uses REXML which is very slow. We use Nokogiri because it is faster and is still maintained.

@IndigoCZ
Copy link
Author

IndigoCZ commented Dec 8, 2011

Is there any chance of Savon switching to something other than Crack?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants