{{
response.files.append(URL('static','css/web2py.css'))
response.files.append(URL('static','css/bootstrap.min.css'))
response.files.append(URL('static','css/bootstrap-responsive.min.css'))
response.files.append(URL('static','css/web2py_bootstrap.css'))
}}
{{response.files = [URL('static', 'css/%s.css' % file) for file in
['web2py', 'bootstrap.min', 'bootstrap-responsive.min', 'web2py_bootstrap']] + response.files}}
Yes we should.Moreover we should pay attention to (https://develoweb2pypers.google.com/speed/articles/include-scripts-properly):
{{
response.files.insert(0,URL('static','js/jquery.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.include_meta()
response.include_files()
}}
<head>
<title>{{=response.title or request.application}}</title>
<!--[if !HTML5]>
<meta http-equiv="X-UA-Compatible" content="IE=edge{{=not request.is_local and ',chrome=1' or ''}}">
<![endif]-->
<!-- www.phpied.com/conditional-comments-block-downloads/ -->
<!-- Always force latest IE rendering engine
(even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta charset="utf-8" />
<!-- http://dev.w3.org/html5/markup/meta.name.html -->
<meta name="application-name" content="{{=request.application}}" />
<!-- Speaking of Google, don't forget to set your site up:
http://google.com/webmasters -->
<meta name="google-site-verification" content="" />
<!-- Mobile Viewport Fix
j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
device-width: Occupy full width of the screen in its current orientation
initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
user-scalable = yes allows the user to zoom in -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{response.include_meta()}}
<link rel="shortcut icon" href="{{=URL('static','images/favicon.ico')}}" type="image/x-icon">
<link rel="apple-touch-icon" href="{{=URL('static','images/favicon.png')}}">
{{include 'web2py_ajax.html'}}
<!-- include stylesheets -->
{{# default stylesheets
response.files.insert(0, URL('static','css/web2py.css'))
response.files.insert(1, URL('static','css/bootstrap.min.css'))
response.files.insert(2, URL('static','css/bootstrap-responsive.min.css'))
response.files.insert(3, URL('static','css/web2py_bootstrap.css'))
response.files.insert(4, URL('static','css/calendar.css'))
}}
{{# user stylesheets (css extension)
# response.files.append (custom_file)
}}
<!-- include javascripts -->
{{# default javascript
response.files.append(URL('static','js/modernizr.custom.js'))
response.files.append(URL('static','js/jquery.js'))
response.files.append(URL('static','js/web2py.js'))
response.files.append(URL('static','js/calendar.js'))
}}
{{# user javascripts (js extension)
# response.files.append (custom_file)
}}
response.include_files()
<!-- uncomment here to load jquery-ui
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/base/jquery-ui.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" type="text/javascript"></script>
uncomment to load jquery-ui //-->
<noscript><link href="{{=URL('static', 'css/web2py_bootstrap_nojs.css')}}" rel="stylesheet" type="text/css" /></noscript>
{{
# using sidebars need to know what sidebar you want to use
left_sidebar_enabled = globals().get('left_sidebar_enabled',False)
right_sidebar_enabled = globals().get('right_sidebar_enabled',False)
middle_columns = {0:'span12',1:'span9',2:'span6'}[
(left_sidebar_enabled and 1 or 0)+(right_sidebar_enabled and 1 or 0)]
}}
{{block head}}{{end}}
</head>
I'm sorry for my poor clarity (my English sucks) but the app was a simple test to demonstrate the benefits coming from a riorganization of how the static files (css and js) are served (not only for timing) and not to compare point to point the current strategy adopted by web2py due to proved reasons. For this I used in my test app cdn resources (http/https no matter in this test case) and last jQuery (line 1.x) while web2py doesn't. I used webpagetest.org in order to have a platform to calculate a benchmark indipendently from my enviroment but we could use another one that has less issues. Maybe http://speed.webstatzone.comAnyway my argumentation is founded on best practices suggested to improve the performance of a web site. Most of html/css/js frameworks apply the structure I indicated (css on top and js on bottom). For example html5 boilerplate index.html (https://github.com/h5bp/html5-boilerplate), twitter bootstrap (http://getbootstrap.com/getting-started/#template), foundation (https://github.com/zurb/foundation/blob/master/templates/project/index.html), backbone boilerplate (https://github.com/backbone-boilerplate/backbone-boilerplate/blob/master/index.html).Moreover searching in the net we will found a bunch of articles on how improve web site performance (for example https://developers.google.com/speed/articles/, http://developer.yahoo.com/yslow/) which suggest the structure I said.In conclusion my previous post is academic not a proposal change. I think that by exchanging ideas we will end to find a way to improve web2py.@Massimofor more details on jquery-migrate plugin please see https://github.com/jquery/jquery-migrate/#readme
Il giorno martedì 6 agosto 2013 15:06:07 UTC+2, Niphlod ha scritto:I'm not a big fan of regression tests (especially web-based), but really, you should give numbers and comparisons to support this. Any "webpagetest.org" test has issues that crimple speed tests in so many ways you can't control that saying "it's faster" is not going to reassure me :P
I slightly modified your app to match at least the same jquery version of the standard welcome app as it is right now, and skipped the jquery compatibility module to be as fair as I could.
Please note I'm not criticizing what you're trying to do, but I'm just trying to figure out what "counters" to observe to match the "speed improvement" that I should notice
Now, a few observations from your tests.....
First big issue: cdn. You can't really test the speed between a page served all from one server and with something loaded from a cdn.
Second (little issue): even if we'd accept to use CDNs (and I'm totally NOT up for it), https with jquery works only from microsoft and google's cdn, not with the code.jquery.com domain
Third: please forgive my total lack of "lets see what counters to look at" but at least locally with firebug your app has an onload time of 30-40ms less than the default welcome (of course not the first load, cause localhost beats CDN), but for some reason 70-150ms higher than the default one with all static files gzipped.
in this light, I'm just up to reorganize the default welcome app to put js first than css (right now its backwards), but just because it's "recommended" as I can't observe any speed difference with the tools at my toolbelt.
tl;dr: I don't know where to look for speed improvements because putting all in head vs leaving js at the bottom seems to not give any performance benefit.
On a totally different note (other counter, but still something to look to), your version of the welcome app takes on my pc 4-8 ms more to generate the markup, reaching 20-22ms vs 16-18ms of the standard one.
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.