Just came across a post discussing the jQuery selector speed, http://www.nabble.com/selector-best-practice-td22032693s27240.html
Seems jQuery selector is slower than native DOM operators in Firefox. But I still think it is a huge enhancement to Tellurium for the following reasons: 1) jQuery hides browser details and you do not need to worry about if your code may not work in other browsers 2) jQuery selector can return multiple elements in one method call, which makes Tellurium much faster in some use cases such as getting data from a big table. 3) Tellurium engine will use jQuery and exploit the UI module so that the UI module will be a speed bless instead of a curse. Last but not the least, jQuery is designed to speed up the testing in IE, I still think we can get much better speed in IE. On Apr 15, 2:12 pm, Jian Fang <[email protected]> wrote: > Hi Dominicm, > > For abstract container, you do not need (should not actually, maybe I gave > bad examples in my tutorials?) to specify the clocator and you can use > > ui.Container(uid:'coupon'){ > > > Table(uid:'table',clocator:[id:'MVContentPredictionsTable']){ > > Container(uid:"all",clocator:[:]){ > > } > > } > > } > > Does the inner Container include any attributes in clocator? Could you post > the generated jQuery selector here? > > Also, you could run our benchmark project in IE if you have any time. > > Thanks, > > Jian > > On Wed, Apr 15, 2009 at 2:05 PM, dominicm <[email protected]>wrote: > > > > > Hi John, > > > Forgot to mention that results were from IE. > > > The JQuery selector used was generated using Tellurium, so maybe there > > is some tuning to do. > > > It's probably inserting the "*" because of the abstract container in > > the ui module > > > ui.Container(uid:'coupon',clocator:[:]){ > > Table(uid:'table',clocator:[id:'MVContentPredictionsTable']){ > > Container(uid:"all",clocator:[:]){ > > } > > } > > } > > > If I remove the "*" then things are much faster. > > > In all cases the getText command does not return anything, although > > the XPath version does. > > > On Apr 15, 6:22 pm, John <[email protected]> wrote: > > > I added another set of tests without group locating and here are the > > > results I tested in my Linux box with Firefox 2. > > > > Final results: > > > TestName: testFlowByDefaultXPath, TotalTime: 44432ms, RepeatCount: 2, > > > AverageAccumulatedTime: 13502ms > > > TestName: testFlowByJavascriptXPath, TotalTime: 38527ms, RepeatCount: > > > 2, AverageAccumulatedTime: 13528ms > > > TestName: testFlowByJQuerySelector, TotalTime: 42404ms, RepeatCount: > > > 2, AverageAccumulatedTime: 14776ms > > > TestName: testFlowByDefaultXPathNoGroup, TotalTime: 38111ms, > > > RepeatCount: 2, AverageAccumulatedTime: 13488ms > > > TestName: testFlowByJavascriptXPathNoGroup, TotalTime: 41408ms, > > > RepeatCount: 2, AverageAccumulatedTime: 13420ms > > > TestName: testFlowByJQuerySelectorNoGroup, TotalTime: 54359ms, > > > RepeatCount: 2, AverageAccumulatedTime: 14643ms > > > TestName: testGetDataByDefaultXPath, TotalTime: 90851ms, RepeatCount: > > > 2, AverageAccumulatedTime: 44811ms > > > TestName: testGetDataByJavascriptXPath, TotalTime: 91112ms, > > > RepeatCount: 2, AverageAccumulatedTime: 44755ms > > > TestName: testGetDataByJQuerySelector, TotalTime: 1665ms, > > > RepeatCount: 2, AverageAccumulatedTime: 165ms > > > > Where TotalTime is the total test run time, RepeatCount is the number > > > of repeated tests. AverageAccumulatedTime is the average time > > > for the time the code spent on a list of test methods that we think > > > are not affected by network latency, which should be more accurate > > > than the TotalTime. > > > > Seems jQuery Selector is a bit slower than XPath in Firefox, but > > > almost at the same speed (This also means there are room for us > > > to improve the jQuery selector). But for Bulk data, jQuery is way > > > better since it only uses one method call. > > > > Hope someone can checkout the benchmark project and provide us the > > > results in IE and other web browsers. > > > > Thanks, > > > > Jian > > > > On Apr 15, 12:30 pm, Jian Fang <[email protected]> wrote: > > > > > Also, why you have * before "table#MVContentPredictionsTable"? "*" > > matches > > > > all and does not really contribute > > > > to anything, but may cause some performance problem, thus jQuery > > selector > > > > will automatically skip that. Could you remove the "*" and re-run the > > code? > > > > > Thanks, > > > > > Jian > > > > > On Wed, Apr 15, 2009 at 12:01 PM, dominicm <[email protected] > > >wrote: > > > > > > Hi All, > > > > > > I've conducted some very basic relative timings for JQuery vs XPath > > > > > selectors in Selenium, using the same rather old and difficult > > > > > frontend code as I used when baselining css selectors. > > > > > > Code is as follows: > > > > > > Use faster XPath library > > > > > sel.useXpathLibrary("javascript"); > > > > > sel.isElementPresent("//descendant-or-self::*/descendant-"+ > > > "or-self::tab...@id='MVContentPredictionsTable']/tbody/tr[child::td] > > > > > [8]/td[5]/des"+ > > > > > "cendant-or-self::*"); > > > > > > sel.getText("//descendant-or-self::*/descendant-"+ > > > "or-self::tab...@id='MVContentPredictionsTable']/tbody/tr[child::td] > > > > > [8]/td[5]/des"+ > > > > > "cendant-or-self::*"); > > > > > > sel.isElementPresent("jquery=* table#MVContentPredictionsTable > > > tbody > > > > > > tr:has(td):eq(8) > td:eq(5)"); > > > > > sel.getText("jquery=* table#MVContentPredictionsTable > tbody > > > tr:has > > > > > (td):eq(8) > td:eq(5)"); > > > > > > Performance for the above for both JQuery and css was appalling, > > > > > taking over 2 minutes in total, compared to 20secs for XPath. > > > > > > The only way I could get JQ to respond in a decent time (4secs) was > > to > > > > > modify the selector to > > > > > "jquery=*#MVContentPredictionsTable > tbody > tr:has(td):eq(8) > > > td:eq > > > > > (5)" > > > > > but this did not find the correct element- Hide quoted text - > > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tellurium-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en -~----------~----~----~----~------~----~------~--~---
