Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-09 Thread Massimo Lusetti
On Thu, Nov 8, 2012 at 6:32 PM, Howard Lewis Ship hls...@gmail.com wrote:

I modified the fiddle to loop 100 times; this will partially account for
 cachine, and MV optimizations.  By the last round:

 idLookup: 2ms
 dataLookup: 15ms

 Still, tiny amounts of time.


I would definitely prefer the attribute driver approach even in case of a
need of a complete scan on each page or section.

Said that I would ask if that time would increase with and increase in the
complexity of the page? How many fiddle elements (maybe compared to id
elements) could have a page like GMail ?

One more think to note is: since more and more communities are going
towards a data- like approach I think that that sentiment could drive the
future developments of javascript frameworks and javascript engines.

Cheers
-- 
Massimo


Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-09 Thread Howard Lewis Ship
I'm working on a revised DateField right now, and driving it towards the
unobtrusive approach instead of the explicit approach.


On Fri, Nov 9, 2012 at 6:42 AM, Massimo Lusetti mluse...@gmail.com wrote:

 On Thu, Nov 8, 2012 at 6:32 PM, Howard Lewis Ship hls...@gmail.com
 wrote:

 I modified the fiddle to loop 100 times; this will partially account for
  cachine, and MV optimizations.  By the last round:
 
  idLookup: 2ms
  dataLookup: 15ms
 
  Still, tiny amounts of time.
 

 I would definitely prefer the attribute driver approach even in case of a
 need of a complete scan on each page or section.

 Said that I would ask if that time would increase with and increase in the
 complexity of the page? How many fiddle elements (maybe compared to id
 elements) could have a page like GMail ?

 One more think to note is: since more and more communities are going
 towards a data- like approach I think that that sentiment could drive the
 future developments of javascript frameworks and javascript engines.

 Cheers
 --
 Massimo




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com


Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-09 Thread Massimo Lusetti
BTW I've run the fiddle on my box several times and here are the average:

idLookup took: 6ms, found:1000
dataLookup took: 8ms, found: 1000

Cheers


On Fri, Nov 9, 2012 at 6:45 PM, Howard Lewis Ship hls...@gmail.com wrote:

 I'm working on a revised DateField right now, and driving it towards the
 unobtrusive approach instead of the explicit approach.


 On Fri, Nov 9, 2012 at 6:42 AM, Massimo Lusetti mluse...@gmail.com
 wrote:

  On Thu, Nov 8, 2012 at 6:32 PM, Howard Lewis Ship hls...@gmail.com
  wrote:
 
  I modified the fiddle to loop 100 times; this will partially account for
   cachine, and MV optimizations.  By the last round:
  
   idLookup: 2ms
   dataLookup: 15ms
  
   Still, tiny amounts of time.
  
 
  I would definitely prefer the attribute driver approach even in case of a
  need of a complete scan on each page or section.
 
  Said that I would ask if that time would increase with and increase in
 the
  complexity of the page? How many fiddle elements (maybe compared to id
  elements) could have a page like GMail ?
 
  One more think to note is: since more and more communities are going
  towards a data- like approach I think that that sentiment could drive
 the
  future developments of javascript frameworks and javascript engines.
 
  Cheers
  --
  Massimo
 



 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com




-- 
Massimo
http://meridio.blogspot.com


Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-08 Thread Lance Java
Sounds to me like a benchmark is needed to compare id lookup against full DOM
scan for data attributes on all the major browsers on small, medium and
large web pages.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/5-4-JavaScript-Explicit-vs-Unobtrusive-initialization-tp5717787p5717811.html
Sent from the Tapestry - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org



Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-08 Thread Lance Java
Here's a first attempt at benchmarking the differences:
http://jsfiddle.net/xPVy6/6/



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/5-4-JavaScript-Explicit-vs-Unobtrusive-initialization-tp5717787p5717818.html
Sent from the Tapestry - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org



Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-08 Thread trsvax
If I understand your question correctly you are trying to figure out if it's
better to initialize the javascript elements on the client side by id or by
some other kind of selector.

I use both Bootstrap and the Facebook apis and they both use data elements
and then automatically initialize the various widgets. As you say this does
not work in Zones so I created a run once javascript addition to
JavaScriptSupport to handle this. 

I did run across this benchmark which might be apply to zones. It appears

$(container).children('') is faster than $('container.children')

http://seesparkbox.com/foundry/jquery_selector_performance_testing

The good thing about that is container could be 'body' for a page load and
the zone id for a zone load. 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/5-4-JavaScript-Explicit-vs-Unobtrusive-initialization-tp5717787p5717819.html
Sent from the Tapestry - Dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org



Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-08 Thread Howard Lewis Ship
I modified the fiddle to loop 100 times; this will partially account for
cachine, and MV optimizations.  By the last round:

idLookup: 2ms
dataLookup: 15ms

Still, tiny amounts of time.




On Thu, Nov 8, 2012 at 4:45 AM, Lance Java lance.j...@googlemail.comwrote:

 Here's a first attempt at benchmarking the differences:
 http://jsfiddle.net/xPVy6/6/



 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/5-4-JavaScript-Explicit-vs-Unobtrusive-initialization-tp5717787p5717818.html
 Sent from the Tapestry - Dev mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: dev-h...@tapestry.apache.org




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com


Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-08 Thread Thiago H de Paula Figueiredo
On Thu, 08 Nov 2012 15:32:56 -0200, Howard Lewis Ship hls...@gmail.com  
wrote:



I modified the fiddle to loop 100 times; this will partially account for
cachine, and MV optimizations.  By the last round:

idLookup: 2ms
dataLookup: 15ms

Still, tiny amounts of time.


Which browser? Anyway, even hating IE as much as I do, specially old  
versions, in one project we needed to remove proper JS event listeners and  
replace them with onxxx atributes because IE8 couldn't handle them without  
slowing to a crawl in long pages.


--
Thiago H. de Paula Figueiredo

-
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org



Re: 5.4 JavaScript: Explicit vs. Unobtrusive initialization

2012-11-08 Thread Howard Lewis Ship
Maybe Tapestry should automatically display a Switch to Chrome alert if
it detects IE :-)


On Thu, Nov 8, 2012 at 10:32 AM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Thu, 08 Nov 2012 15:32:56 -0200, Howard Lewis Ship hls...@gmail.com
 wrote:

  I modified the fiddle to loop 100 times; this will partially account for
 cachine, and MV optimizations.  By the last round:

 idLookup: 2ms
 dataLookup: 15ms

 Still, tiny amounts of time.


 Which browser? Anyway, even hating IE as much as I do, specially old
 versions, in one project we needed to remove proper JS event listeners and
 replace them with onxxx atributes because IE8 couldn't handle them without
 slowing to a crawl in long pages.

 --
 Thiago H. de Paula Figueiredo


 --**--**-
 To unsubscribe, e-mail: 
 dev-unsubscribe@tapestry.**apache.orgdev-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: dev-h...@tapestry.apache.org




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com