Re: [webkit-gtk] dns prefetching knob
Updated patch that includes comments from the webkit folks. I added some performance numbers to: https://bugs.webkit.org/show_bug.cgi?id=55973 Any chance this can make it in 1.2.8? --- WebCore/ChangeLog.orig Tue Mar 8 16:16:50 2011 +++ WebCore/ChangeLog Tue Mar 8 16:10:10 2011 @@ -1,3 +1,19 @@ +2011-03-08 Marco Peereboom marco@peereboom.u + +Reviewed no one yet + +Backport code to enable/disable dns prefetching. +DNS prefetching is enabled by default. +https://bugs.webkit.org/show_bug.cgi?id=28825 + +* dom/Document.cpp: +(WebCore::Document::initDNSPrefetch): Check settings-dnsPrefetchingEnabled(). +* page/Settings.cpp: +(WebCore::Settings::Settings): Set m_dnsPrefetchingEnabled to true. +(WebCore::Settings::setDNSPrefetchingEnabled): Added. Set m_dnsPrefetchingEnabled. +* page/Settings.h: +(WebCore::Settings::dnsPrefetchingEnabled): Added. Return m_dnsPrefetchingEnabled. + 2010-06-21 Philippe Normand pnorm...@igalia.com Reviewed by Xan Lopez. --- WebCore/dom/Document.cpp.orig Fri Sep 10 08:20:33 2010 +++ WebCore/dom/Document.cppTue Mar 8 10:16:45 2011 @@ -4639,8 +4639,10 @@ HTMLCanvasElement* Document::getCSSCanvasElement(const void Document::initDNSPrefetch() { +Settings* settings = this-settings(); + m_haveExplicitlyDisabledDNSPrefetch = false; -m_isDNSPrefetchEnabled = securityOrigin()-protocol() == http; +m_isDNSPrefetchEnabled = settings settings-dnsPrefetchingEnabled() securityOrigin()-protocol() == http; // Inherit DNS prefetch opt-out from parent frame if (Document* parent = parentDocument()) { --- WebCore/page/Settings.cpp.orig Fri Sep 10 08:20:33 2010 +++ WebCore/page/Settings.cpp Tue Mar 8 15:48:38 2011 @@ -128,6 +128,7 @@ Settings::Settings(Page* page) , m_webGLEnabled(false) , m_loadDeferringEnabled(true) , m_tiledBackingStoreEnabled(false) +, m_dnsPrefetchingEnabled(true) { // A Frame may not have been created yet, so we initialize the AtomicString // hash before trying to use it. @@ -509,6 +510,11 @@ void Settings::setShouldPaintNativeControls(bool shoul void Settings::setUsesEncodingDetector(bool usesEncodingDetector) { m_usesEncodingDetector = usesEncodingDetector; +} + +void Settings::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled) +{ +m_dnsPrefetchingEnabled = dnsPrefetchingEnabled; } void Settings::setAllowScriptsToCloseWindows(bool allowScriptsToCloseWindows) --- WebCore/page/Settings.h.origFri Sep 10 08:20:33 2010 +++ WebCore/page/Settings.h Tue Mar 8 10:16:45 2011 @@ -158,6 +158,9 @@ namespace WebCore { void setUsesEncodingDetector(bool); bool usesEncodingDetector() const { return m_usesEncodingDetector; } + void setDNSPrefetchingEnabled(bool); + bool dnsPrefetchingEnabled() const { return m_dnsPrefetchingEnabled; } + void setUserStyleSheetLocation(const KURL); const KURL userStyleSheetLocation() const { return m_userStyleSheetLocation; } @@ -376,6 +379,7 @@ namespace WebCore { bool m_webGLEnabled : 1; bool m_loadDeferringEnabled : 1; bool m_tiledBackingStoreEnabled : 1; + bool m_dnsPrefetchingEnabled : 1; #if USE(SAFARI_THEME) static bool gShouldPaintNativeControls; --- WebKit/gtk/ChangeLog.orig Tue Mar 8 16:17:18 2011 +++ WebKit/gtk/ChangeLogTue Mar 8 16:14:29 2011 @@ -1,3 +1,20 @@ +2011-03-08 Marco Peereboom ma...@peereboom.us + +Reviewed no one yet + +Provide a knob to enable/disable DNS prefetching. +DNS prefetching is enabled by default. +https://bugs.webkit.org/show_bug.cgi?id=28825 + +* WebKit/gtk/webkit/webkitwebsettings.cpp: +(webkit_web_settings_class_init): +(webkit_web_settings_set_property): +(webkit_web_settings_get_property): +(webkit_web_settings_copy): +* webkit/webkitwebview.cpp: +(webkit_web_view_update_settings): +(webkit_web_view_settings_notify): + 2010-06-15 Xan Lopez xlo...@igalia.com Reviewed by Gustavo Noronha. --- WebKit/gtk/webkit/webkitwebsettings.cpp.origTue Mar 8 11:35:14 2011 +++ WebKit/gtk/webkit/webkitwebsettings.cpp Wed Mar 9 05:43:47 2011 @@ -108,6 +108,7 @@ struct _WebKitWebSettingsPrivate { gboolean enable_page_cache; gboolean auto_resize_window; gboolean enable_java_applet; +gboolean dns_prefetching; }; #define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate)) @@ -157,7 +158,8 @@ enum { PROP_ENABLE_SITE_SPECIFIC_QUIRKS, PROP_ENABLE_PAGE_CACHE, PROP_AUTO_RESIZE_WINDOW, -PROP_ENABLE_JAVA_APPLET +PROP_ENABLE_JAVA_APPLET, +PROP_DNS_PREFETCHING }; // Create a default user agent string @@ -857,6 +859,21 @@ static void
Re: [webkit-gtk] dns prefetching knob
On Wed, 2011-03-09 at 07:16 -0500, Dan Winship wrote: On 03/08/2011 07:07 PM, Marco Peereboom wrote: I created a bug report to add a DNS prefetch knob but I was advised to also send the patch to the mailing list. With this knob I can make the web browser I wrote (xxxterm http://opensource.conformal.com/wiki/XXXTerm ) much snappier on sites with lots of embedded domain names (news.google.com for example). The entire point of DNS prefetching is that it's supposed to make the browser faster. If it's not doing that, then the right thing would be to remove it entirely, not to add a configurable be broken / don't be broken option. I agree, although it might make sense to make it a build-time option. Marco, in your changelog you say that you are 'Backporting' - backporting from what? Cheers, -- Gustavo Noronha Silva g...@gnome.org GNOME Project ___ webkit-gtk mailing list webkit-gtk@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk
Re: [webkit-gtk] dns prefetching knob
On Wed, Mar 09, 2011 at 09:33:21AM -0300, Gustavo Noronha Silva wrote: On Wed, 2011-03-09 at 07:16 -0500, Dan Winship wrote: On 03/08/2011 07:07 PM, Marco Peereboom wrote: I created a bug report to add a DNS prefetch knob but I was advised to also send the patch to the mailing list. With this knob I can make the web browser I wrote (xxxterm http://opensource.conformal.com/wiki/XXXTerm ) much snappier on sites with lots of embedded domain names (news.google.com for example). The entire point of DNS prefetching is that it's supposed to make the browser faster. If it's not doing that, then the right thing would be to remove it entirely, not to add a configurable be broken / don't be broken option. I agree, although it might make sense to make it a build-time option. Marco, in your changelog you say that you are 'Backporting' - backporting from what? https://bugs.webkit.org/show_bug.cgi?id=28825 The mac version. I took the original patch and added the GTK bits. ___ webkit-gtk mailing list webkit-gtk@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk
Re: [webkit-gtk] dns prefetching knob
On 03/09/2011 07:55 AM, Marco Peereboom wrote: For some reason people are still attached to this relic of the modem era. DNS prefetch is optional in the HTTP spec and the time has come to admit that it no longer serves a purpose. Back in the day when modems were king and DNS lookups were expensive you could save some time when a user clicked on a link. Times have changes and the web has evolved. Prefetch isn't mentioned in the HTTP spec at all. And I don't think anyone was doing it back in the modem age. AFAIK, Google started doing it with Chrome, and other people followed. It *does* help in some cases. Lots of sites have lame slow DNS servers (and lots of ISPs have lame slow recursive resolvers). We just don't want to try to pre-resolve every single link on the page. -- Dan ___ webkit-gtk mailing list webkit-gtk@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk
Re: [webkit-gtk] dns prefetching knob
Penned by Dan Winship on 20110309 8:10.16, we have: | On 03/09/2011 07:55 AM, Marco Peereboom wrote: | For some reason | people are still attached to this relic of the modem era. DNS prefetch | is optional in the HTTP spec and the time has come to admit that it no | longer serves a purpose. Back in the day when modems were king and DNS | lookups were expensive you could save some time when a user clicked on a | link. Times have changes and the web has evolved. | | Prefetch isn't mentioned in the HTTP spec at all. And I don't think | anyone was doing it back in the modem age. AFAIK, Google started doing | it with Chrome, and other people followed. | | It *does* help in some cases. Lots of sites have lame slow DNS servers | (and lots of ISPs have lame slow recursive resolvers). We just don't | want to try to pre-resolve every single link on the page. | | -- Dan Dan, Would you at least agree that it causes no harm for us to be able to disable the option if we want to see for our selves? What are the downsides of adding this diff? Thanks, -- Todd Fries .. t...@fries.net _ | \ 1.636.410.0632 (voice) | Free Daemon Consulting, LLC \ 1.405.227.9094 (voice) | http://FreeDaemonConsulting.com \ 1.866.792.3418 (FAX) | 2525 NW Expy #525, Oklahoma City, OK 73112 \ sip:freedae...@ekiga.net | ..in support of free software solutions. \ sip:4052279...@ekiga.net \\ 37E7 D3EB 74D0 8D66 A68D B866 0326 204E 3F42 004A http://todd.fries.net/pgp.txt ___ webkit-gtk mailing list webkit-gtk@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk
Re: [webkit-gtk] dns prefetching knob
On Wed, Mar 9, 2011 at 6:28 AM, Marco Peereboom sl...@peereboom.us wrote: Hence the knobbing part. Some people have legitimate use for it which is of course fine. I want it for performance reasons but also to prevent DNS tracking. Between DNS prefetching, link hovering and the empty DNS lookups webkit generates one can get near pixel resolution on how the user moves his mouse. This comes in handy for Online Behavioral Tracking. Being a practical paranoid I'd like to prevent that. Is it possible for you to make the tools you used to generate your performance number available publically? This would help us fix any performance issues that exist as bugs. This may very well be some weird corner case that we're hitting in libsoup. Let's fix it! I do not think there is any harm in exposing this setting. I do believe that those pushing for it should try to clarify what it is though. From what I gather it's effectively two pieces: 1. A backport of a Settings.cpp DNS prefetch change to the stable branch. 2. New code which exposes this setting in the WebKitWebSettings WebKitGTK+ API. Really it should just be the change to WebKitWebSettings and a request to merge both changes back into the stable branch. Be aware that we are desperately close to cutting the stable branch for 1.4.x. --Martin ___ webkit-gtk mailing list webkit-gtk@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk
Re: [webkit-gtk] dns prefetching knob
On Wed, Mar 09, 2011 at 08:55:37AM -0800, Martin Robinson wrote: On Wed, Mar 9, 2011 at 6:28 AM, Marco Peereboom sl...@peereboom.us wrote: Hence the knobbing part. ??Some people have legitimate use for it which is of course fine. ??I want it for performance reasons but also to prevent DNS tracking. ??Between DNS prefetching, link hovering and the empty DNS lookups webkit generates one can get near pixel resolution on how the user moves his mouse. ??This comes in handy for Online Behavioral Tracking. ??Being a practical paranoid I'd like to prevent that. Is it possible for you to make the tools you used to generate your performance number available publically? This would help us fix any performance issues that exist as bugs. This may very well be some weird corner case that we're hitting in libsoup. Let's fix it! Sure, it is far less interesting than you'd hope for ;-) The patch at the bottom is what generates the numbers I quoted. It goes against the in tree cvs version of xxxterm. Tree is at: CVSROOT=anon...@opensource.conformal.com:/anoncvs/xxxterm The DNS lookup stuff I measured with the adsuck stats but I don't think that is pertinent to this discussion. If you guys want a rundown on that as well let me know and I'll show ya. I do not think there is any harm in exposing this setting. I do believe that those pushing for it should try to clarify what it is though. From what I gather it's effectively two pieces: 1. A backport of a Settings.cpp DNS prefetch change to the stable branch. Correct. 2. New code which exposes this setting in the WebKitWebSettings WebKitGTK+ API. Right. Really it should just be the change to WebKitWebSettings and a request to merge both changes back into the stable branch. Be aware that we are desperately close to cutting the stable branch for 1.4.x. This is why I really really really would like to get this cranking :-) --Martin Index: xxxterm.c === RCS file: /cvs/xxxterm/xxxterm/xxxterm.c,v retrieving revision 1.348 diff -u -p -u -p -r1.348 xxxterm.c --- xxxterm.c 8 Mar 2011 23:19:36 - 1.348 +++ xxxterm.c 9 Mar 2011 17:38:34 - @@ -218,6 +218,9 @@ struct tab { WebKitWebSettings *settings; int font_size; gchar *user_agent; + + struct timeval sod; + struct timeval eod; }; TAILQ_HEAD(tab_list, tab); @@ -492,6 +495,7 @@ char*user_agent = NULL; intsave_rejected_cookies = 0; time_t session_autosave = 0; intguess_search = 0; +intdns_prefetch = FALSE; struct settings; struct key_binding; @@ -5768,6 +5772,7 @@ notify_load_status_cb(WebKitWebView* wvi struct history *h, find; const gchar *s_loading; struct karg a; + struct timeval elapsed; DNPRINTF(XT_D_URL, notify_load_status_cb: %d\n, webkit_web_view_get_load_status(wview)); @@ -5780,6 +5785,7 @@ notify_load_status_cb(WebKitWebView* wvi switch (webkit_web_view_get_load_status(wview)) { case WEBKIT_LOAD_PROVISIONAL: /* 0 */ + gettimeofday(t-sod, NULL); abort_favicon_download(t); #if GTK_CHECK_VERSION(2, 20, 0) gtk_widget_show(t-spinner); @@ -5865,6 +5871,11 @@ notify_load_status_cb(WebKitWebView* wvi gtk_label_set_text(GTK_LABEL(t-label), (untitled)); default: gtk_widget_set_sensitive(GTK_WIDGET(t-stop), FALSE); + + gettimeofday(t-eod, NULL); + timersub(t-eod, t-sod, elapsed); + fprintf(stderr, prefetch %d: page load time: %ld.%.6ld - %s\n, + dns_prefetch, elapsed.tv_sec, elapsed.tv_usec, uri); break; } @@ -6618,6 +6629,8 @@ stop_cb(GtkWidget *w, struct tab *t) void setup_webkit(struct tab *t) { + g_object_set(G_OBJECT(t-settings), + dns-prefetching, dns_prefetch, (char *)NULL); g_object_set(G_OBJECT(t-settings), user-agent, t-user_agent, (char *)NULL); g_object_set(G_OBJECT(t-settings), ___ webkit-gtk mailing list webkit-gtk@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk