dojox.mobile.view slow - dojo

when tapping just on the "Back button" it last 1-1.5secs (iOS 4-5 iPhones) seconds before it goes back. Is there anything I can do ?
I had a closer look and removed ALL bottlenecks in my code. Even when the view is empty, its unacceptable slow.
I also had a look in the dojo sources, its seems that dojo.setStyle and dojo.setClass is called a few hundreds times when moving in or out a view. I debugged this with a self baken mozilla browser and its true, dojo view changes involve a complete repaint/reflow of the entire dom tree, thats more than bad.
We spent now 3.5 months fulltime on a commercial project and the customer is not happy with the performance at all and I'am facing a little desaster.
I also saw that dojo prefers DOM manipulation instead of innerHTML and wants even stick to that. Are there any workarounds or utils within the DOJO framework to support innerHTML approaches ?
Looks, I need to rewrite the view class.
Any suggestions are welcome, guenter

Are you running an optimized build or from source? Any chance this is a file load/latency problem?
I'd recommend you take your comments to dojo-interest where the community and dojox.mobile maintainers are more likely to see it. You may also want to post some examples to demonstrate the performance problems you're seeing.

Related

Is there a Dojo calendar similar to the JQuery plugin FullCalendar?

I'm looking a Dojo based calendar that can display events spanning across days in a month view exactly like the JQuery plugin FullCalendar
I work primarily in Dojo and I don't want to load JQuery if I don't need to.
This thread is a bit old now but I wanted to raise that there's now a candidate widget written by me for dojo 1.8+ that does exactly what you need: https://github.com/damiengarbarino/dojo-calendar
I tried to use the dojoc project and finally developed my own widget.
It is heavily customizable, has mouse, keyboard and even touch support, right to left display support, date formatting, custom views etc.
Documentation is available at: http://livedocs.dojotoolkit.org/dojox/calendar
I've been searching for something similiar recently and the best I can find is the 'dojoc' library. It appears to have been apart of the full dojotoolkit at some point but I can't seem to find a whole lot of information on it.
A test page showing it is on the author's website here. The github page for it is here. So far my attempts to locally use it have failed miserably. It seems to be built against an older version of dojo as well since it hasn't been updated in a while.
Although the Dojo 1.8 calendar widget looks promising, the documentation linked here http://livedocs.dojotoolkit.org/dojox/calendar is not up to scratch. Possibly the widget itself is also not ready for general use.
For example, it is proving difficult to prevent a particular event from being edited.
I realise 1.8 is not out yet. I trust the calendar widget and documentation will be better by the time 1.8 is released.

Switching from ExtJS3 to ExtJS4: Worth the hassle?

We are in the middle of a relatively large project which uses ExtJS3 and have already invested ~4 man-years, using several plugins and we have written some plugins ourselfs. After a quick glance at ExtJS4, it seems that we would have a lot of work to do to migrate the project to ExtJS4. Are there any strong reasons to switch to ExtJS4? Currently, it seems to me that compatibility with future browsers (or the lack thereof) is the only one.
We're in similar situation and our conclusion was to wait a bit more as Ext 3 is doing it's job. We experienced many problems in our "test" migration and I would say that it's more a rewrite of the application than a migration :(. Also, our experience showed that Ext JS 4 has some performance problems, forms are a bit different, store cannot reject changes, it's bigger. There are some very good new features like the new class system, mixins, new charts, ...
We have upgraded our application to ExtJS4 without fail.We are happy to say that ExtJS4 is fast compare to ExtJS3.A new class system,mixins,plugin-free charts,focus management...etc.,. But if you want to upgrade you need to change a lot of code because class system and config options are changed.We have tested the performance of our application using ExtJS3 and ExtJS4,so as per our observation ExtJS4 is fast and it will not break.As per our observation,CSS selectors are also changed if you want to customize the component you can easily do the thing in ExtJS4.
We tried to migrate from ExtJS3 to ExtJS4 previous week. Unfortunately I must say it is like translate english to german. A lot of work. From our point of view more or less just the charting system is plus, minus - a lot of components that we use are not supported, a lot of css customization shoud be done, working code in ExtJS3 breaks easily and there is sometimes almost impossible to find an error.
Not an expert but personally I'd start new project with extjs4 but leave exiting project alone. The charting stuff is amazing in 4!

Selenium Issues

I have been using Selenium a lot lately (testing an ExtJs app) and while in many ways it is wonderful, there are three things that cause me a lot of grief:
Inability to directly click on elements other than buttons. This has led me to write a bunch of Robot code to move the mouse around. That works but is a bit fragile, plus if you touch your mouse while a test is running, you are screwed. I tried the Selenium forums to see if there was a better way, and got nowhere. I think (but am not sure) that this is a fundamental limitation of Selenium's JS injection technique.
Inability in many cases to control what the 'id' attribute get sets to. This happens inside ExtJs and some elements let you set it, some don't, and some do but the attribute ends up where you don't expect it. You end up having to use XPath in some cases. Using XPath with ExtJs is kind of horrible as ExtJs creates massive levels of nested DIV's. You can also sometimes use CSS locators (which are also inconsistently controllable in ExtJs). (BTW, this is obviously not a Selenium problem per se).
The time that Selenium takes to fire up FF is too long... way longer than a normal human FF startup, about 2 seconds per test, which translates into tests that last several minutes, way too long.
I briefly looked at Watij, BadBoy and a couple of other web functional testing apps but none of them looked anywhere near as good as Selenium. (The way Selenium tests can be written in Java and run through jUnit is really, really sweet). There are also a few commercial alternatives but they are beyond my budget and there is no assurance that they would work any better anyway.
Any thoughts or suggestions appreciated.
About 3:
Selenium copies at startup the firefox profile to a temporary folder. If you don't specify a custom profile, Selenium propably uses the default profile which propably is bloated with addons you don't need for the test. Startup Firefox with '-p' and create a new profile for Selenium and copy it to a location you can point selenium to. This should speed up the test a bit.
Update:
Firefox Profile location / Windows: %APPDATA%\Mozilla\Firefox\Profiles
My thoughts:
There are some cases that click isn't enough, but you certainly shouldn't be limited to buttons. You might want to experiment further with your locators.
Why do you need to set the id attribute of elements? I have experience with testing ExtJS applications, and the problem is usually locating elements that have dynamically set ids. In my opinion this is an issue with ExtJS and not Selenium. Using smart XPath techniques using contains, starts-with, and substring can make your locators much more reliable. CSS locators are also often helpful as you mentioned.
As amarsuperstar says, you don't need to start Firefox before every test. If you do, you might want to consider using the browserSessionReuse command to speed up launching the browser. Alternatively you can use Selenium Grid to run tests in parallel.
Finally, it's well worth looking into the WebDriver API that will be in the soon to be released alpha of Selenium 2. In my experience Firefox launch times are reduced, and commands such as click are much improved.
I am not sure about the first two points, but as for the third, I don't think you need to start the browser for every test. You can use the Seleium server (a jar in the selenium directory somewhere) then point your tests to that e.g. localhost:6554 and that will only open the browser once.
With that you can have the steps in your script to start server -> run all test -> terminate server and you will only have one browser session across your tests.
My experiences (hopefully useful ;)
I've never had this problem, even with ExtJS. I have not used it with ExtJS 3.x, though. Is it possible that you are experiencing some thing as a result of your environment rather than Selenium?
UPDATE: As Dave Hunt reminded me, sometimes I've had to use mousedown/mouseup actions in lieu of "click"
I've found many clever ways to navigate using CSS locators (selenium supports most of CSS 3). In addition, you can use xpath like xpath=id('myid')//div['#class='foo'] (the ID part is crucial).
I've also never experienced this. Perhaps you can give some details about your environment?
Thanks for all the answers guys, I really appreciate it. I spent all day yesterday on this stuff and I wanted to add a couple of observations:
The way ExtJS lays stuff out can really make it hard to locate elements. For example, quite often the 'id' that you specified appears on an element that is 2-3-4 items in the DOM above the one you really want. The actual behaviour seems to vary greatly depending on the type of element. I have half a mind to write all this up for the benefit of future Se-ExtJs testers, as it all seems very trial-and-error and tedious. But ultimately it seems like it can be made to work nicely. And, of course, this is in no way a reflection on Se. Whether it reflects poorly on ExtJs, I'm not really sure, but it is amazing how many DIV tags even fairly simple projects create.
This is probably a 'well OBVIOUSLY' but to anyone else doing this, I'd recommend getting comfy with XPath. It seems a bit obtuse at first but after a few hours, as noted above, you can find almost anything with it, and almost always in ways that are not overly brittle.
Happy Holidays!
Selenium is one of the backends to the TestPlan testing framework and it can address a few of these issues for you.
We don't seem to have any problems here. Our front-end uses many different locator syntaxes to locate any elements on the screen. Though if your page is complicated and Selenium truly can't do it then ours won't help you either.
We base everything on XPath, so after a while you just get used to it. There are all sorts of shortcut syntax that you can use in XPath that may help. In TestPlan scripts however you can also use variable expansion in XPaths which makes them much easier to maintain.
TestPlan caches browser sessions when possible and not otherwise requested. This helps the speed a little bit, but only so much since normally you want a fresh session for each test anyway.
TestPlan

Dojo: Will Shrinksafe work together with the Google Closure Compiler?

i read about the Google Closure Compiler and i will try to use it to make my web application better. But i think it is doing the same things like the dojo shrinksafe.
Has anyone tried to use the Google Closure Compiler for a complex dojo project?
Thanks
Benjamin
Yes, Google Closure Compiler works fine with Dojo projects. Because Closure is derived from Dojo, it has similar concepts (modules, loaders, the build, and so on) so it is potentially possible to use some advanced features of Closure Compiler with Dojo, which go beyond simple minification.
We (Dojo) will evaluate what we can reuse and leverage from Closure and how we can improve interoperability. Obviously it will include all tooling too.
Closure will probably work with any valid javascript code. I fed it an extremely packed, obfuscated version of a complex Prototype project of mine and it spit out a perfectly working version. So even if your code has already been shrinked by Dojo, you can probably use Closure on top of it. You should, however, choose one of the two.
As of Dojo 1.4 (not yet released, but the code is in the subversion trunk of Dojo), you can now use Closure Compiler as an option for the Dojo build process. It takes a bit of setting up. Instructions on how to use Closure Compiler with the Dojo build system.
Dojo 1.6 is compatible (after some minor modifications) with Closure Compiler in Advanced mode.
http://dojo-toolkit.33424.n3.nabble.com/file/n2636749/Using_the_Dojo_Toolkit_with_the_Closure_Compiler.pdf?by-user=t
Stephen
I happen to have a 12,000 (26,000 if you include dojox/dijit imports) line dojo 1.3.2 application I am about to release.
Well I used the standard dojo build system to throw it all into one lovely big one megabyte file. Then I introduced it to the google closure compiler, the compilation went very well reducing the package down to 350 kb, 100kb less than yahoo ui, and 150kb less than shrinkwrap. I, of course, did it all in advanced mode like a man.
So far so good, then it was time to load it up! The results were mixed. The site did seem to work, but I did get quite a few pesky errors telling me that various things behind the dojo prefix could not be found. I wasn't able to work out exactly what was going on as I didn't have closure addon for firebug ready, but I didn't notice issues the actual operation of the site - though I posit if I looked hard enough I would have found them.
So I thought to myself it appears the closure compiler is renaming dojo name space in my compiled.js to make them inconsistent with dojo.js. It seemed like an ideal solution was to combine dojo.js.uncompressed.js with my blob.js.uncompressed.js using the closure compiler. This resulted in a 51kb reduction in the size of the dojo library so far so good! Bad idea dojo didn't much like this at all and refused to load! It just downloaded then just sat there in protest of google's world domination.
I have done some further research into this matter, from what I read dojo 1.4.0 does support closure in 'simple' mode, but this is rather pointless because as I read closure simple mode provides a similar amount of compression to yui.
Anyway, those are my thoughts, I have looked at closure a little, it looks like a very nice library. The css layout looks drastically simpler than dijit's, this is something I am very fond of, I've often found it easier to rewrite dijits than try and theme them correctly. It seems to be missing some elements of the dojo library I am rather fond of such as dijit._Widget, dijit. _container/contained and of course the famous dojo.declare(). I suppose I could rebuild these, but why should I?
Addition:
Oh it also appears to be lacking a good RPC, cometed framework, and publish/subscriber framework. Unless I am mistaken. Don't get me wrong I want to like closure, I'm not a dojo apologist by any stretch of the imagination, I just like these parts of dojo. The addition of require and provide does make this a serious contender from my perspective. The lack of a meaningful system of this nature drove me away from jquery.

XRCed learning resources?

I've seen many people saying XRCed very strong "if you have learned how to use it". Unfortuntately, there're few documents about it, and many of the links on SF.net home page is 404 now.
The best I can found is XRCed Tutorial, however it is too primitive - so, does anyone have some idea for where can I find better documents about it?
Just a suggestion; have you tried wxFormBuilder? XRCed seems a little outdated (hasn't been updated for a while), and it does the same thing as wxFB. I've been using wxFB for a while in several projects and it's a life saver.
Alongside the already mentioned wxFormBuilder, I'm going to throw in wxGlade, as well. While I prefer wxFormbuilders GUI, I found it to be lacking in the available widgets. So I moved to wxGlade based on the amount of widgets it offers.
Both can create XRC files (and some other codes like C++ and python) and I think both are actively maintained. I think XRCed hasn't been updated since 2007.
For ease of use, I would go with wxFormBuilder. If you want to use various different widgets, for the moment, go with wxGlade. I don't know if wxFormbuilder is planning on incorporating ToggleButtons and the like in their future releases. It isn't in the one that I am using...