## Re: [saxon] Saxon 9.5 performance problem

 Re: [saxon] Saxon 9.5 performance problem From: Gunther Rademacher - 2013-04-24 20:45:23 ```Thank you. Please note that the svn link is close to those shown on http://saxon.sourceforge.net/ , the difference being http vs. https Meanwhile I tried the fix and indeed it solves the problem for the sample that I sent yesterday. Here are some more cases that I found to require non-linear time while reducing from the original code. This one has a slightly different creation of \$x, however at runtime it does not use MemoClosure.ProgressiveIterator but ChainIterator: declare var iable \$n external; let \$x := (for \$i in 1 to \$n return 1, 0) return sum(for \$i in 1 to \$n return \$x[\$i][1]) The original code was in a tail recursion: declare function local:sum(\$input, \$begin, \$sum) { let \$i := \$input[\$begin] return if (empty(\$i)) then \$sum else local:sum(\$input, \$begin + 1, \$sum + \$i) }; declare variable \$n external; let \$input := (for \$i in 1 to \$n return 1, 0) return local:sum(\$input, 1, 0) Before creating an integer sequence from \$n, I had been processing strings (here effectively counting chars): declare function local:transition(\$input, \$begin, \$current, \$end, \$result) { if (\$result ne 0) then (\$result idiv 2 - 1, \$end) else let \$c0 := (string-to-codepoints(substring(\$input, \$current, 1)), 0)[1] let \$c1 := if (\$c0 eq 0) then 2 else 1 let \$current := \$current + 1 let \$i0 := 2 * \$c1 + 1 let \$next := (0, 0, 4, 0, 6, 0)[\$i0] return local:transition(\$input, \$begin, \$current, \$current, \$next) }; declare function local:count-chars(\$input, \$begin, \$count) { let \$m := local:transition(\$input, \$begin, \$begin, \$begin, 0) return if (\$m[1] eq 1) then local:count-chars(\$input, \$m[2], \$count + 1) else \$count }; declare variable \$n external; let \$input := string-join(for \$i in 1 to \$n return "x", "") return local:count-chars(\$input, 1, 0) All of the above suffer from non-linear time consumption with 9.5 Best regards Gunther On 24.04.2013 17:18, Dr O'Neil Delpratt wrote: > Hi Gunther, > > See below the link to our svn: > > https://dev.saxonica.com/repos/archive/opensource/ > > At present each main release is maintained in it's own folder (i.e. > 'latest9.5/hej' for java version). > > kind regards, > O'Neil > > On 24/04/2013 14:27, Gunther Rademacher wrote: >> Thanks for the update. >> >> I would like to try the fix on the original code, but could not find a >> valid link to svn. The one that I had been using for 9.4 seems to be >> defunct. Is there a way for accessing the fix? >> >> Best regards >> Gunther >> >> >> On 24.04.2013 12:18, Michael Kay wrote: >>> Now fixed, details here: >>> >>> https://saxonica.plan.io/issues/1740 >>> >>> Michael Kay >>> Saxonica >>> >>> >>> On 23 Apr 2013, at 20:29, Gunther Rademacher wrote: >>> >>>> I am facing >>>> some performance degradation on REx parser execution, too. Tried to >>>> reduce it to a minimal test case, and here it is: >>>> >>>> declare variable \$n external; >>>> let \$x := for \$i in 1 to \$n return 1 >>>> return sum(for \$i in 1 to \$n return \$x[\$i][1]) >>>> >> ------------------------------------------------------------------------------ >> Try New Relic Now & We'll Send You this Cool Shirt >> New Relic is the only SaaS-based application performance monitoring service >> that delivers powerful full stack analytics. Optimize and monitor your >> browser, app, & servers with just a few lines of code. Try New Relic >> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr >> _______________________________________________ >> saxon-help mailing list archived at http://saxon.markmail.org/ >> saxon-help@... >> https://lists.sourceforge.net/lists/listinfo/saxon-help >> >> >> ----- >> No virus found in this message. >> Checked by AVG - http://www.avg.com >> Version: 2013.0.3272 / Virus Database: 3162/6269 - Release Date: 04/23/13 >> >> > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help > ```