FYI: https://plus.google.com/+RayCromwell/posts/VK8URgZiLbS


On Tue, Dec 13, 2016 at 10:23 AM, Colin Alworth <niloc...@gmail.com> wrote:
> Class literals for any object which can be created need to exist for
> getClass(), which is called by toString() at the very least - if the
> compiler sees any Object.toString, it must leave in all getClass methods -
> further reasoning about that might be tricky, and is a little out of my
> wheelhouse. If memory serves, class literals are harder to prune since they
> can be used in split points (though the class literals must exist in the
> original split point).
>
> The vars __gwt_stylesLoaded and __get_scriptsLoaded are part of the linker's
> communication with the main page, and how the linker defines what other
> resources it has grabbed up from the .gwt.xml file. $stats serves a similar
> purpose, it is one of several ways for the page to communicate with the
> module and vice versa. A custom linker can be written by forking one of the
> existing ones to remove these or simplify them if you never will have a use
> for them and really must save a dozen or so bytes each. Since there are a
> fixed set of these, it is a constant overhead, and won't grow as your
> application grows. These can't be optimized out without knowing how you will
> end up using the GWT app from the host page, which by definition isn't
> compiled as part of the app.
>
> I *believe* that the useless if statement you showed will be optimized out
> if you avoid PRETTY and do a normal compile, but I am not totally certain -
> clinits do seem to interfere with some optimizations of dead code. I'm
> looking into a way to deal with some of these cases, will post back within a
> few weeks if I am successful (and have time). As before though, simply
> depending on Core instead of User will avoid this entirely.
>
> If you are really after saving individual bytes, especially if you only have
> a single permutation, do look at building your own linker, and depending
> only on Core directly (and skipping the UserAgent module), and possibly
> rebinding some of these generated classes to do nothing.
>
> On Tuesday, December 13, 2016 at 10:17:41 AM UTC-6, Kirill Prazdnikov wrote:
>>
>> Hello,
>>
>> Thanks for the explanation,
>>
>> <set-configuration-property name="user.agent.runtimeWarning"
>> value="false"/>
>>
>>
>> did the job, and removed
>> "$wnd.setTimeout($entry(assertCompileTimeUserAgent));" at the entry point.
>>
>>
>> But document.compatMode.severity=IGNORE did not change anything in code
>> generation, it still generates
>>
>>
>>> severity = ($clinit_DocumentModeAsserter$Severity() , IGNORE);
>>> if (severity == IGNORE) {
>>> return;
>>> }
>>
>>
>> It is unclear for what reason GWT generates (and never uses in the
>> generated code):
>>
>>
>>> if (!$wnd_0.__gwt_stylesLoaded) {
>>>   $wnd_0.__gwt_stylesLoaded = {};
>>> }
>>> if (!$wnd_0.__gwt_scriptsLoaded) {
>>>   $wnd_0.__gwt_scriptsLoaded = {};
>>> }
>>
>>
>>
>> It also would be very nice to remove that:
>>
>>
>>>
>>> function isHostedMode() {...} if (isHostedMode()) { alert(...); }
>>
>>
>>
>> And I see a lot of never used variables in the generated code, ex:
>>
>>
>>> var Lcom_google_gwt_core_client_impl_SchedulerImpl_2_classLit =
>>> createForClass(22);
>>> var onBodyDoneTimerId = setInterval(function () { ....
>>> var $gwt_version = "2.8.0";
>>> var $stats = $wnd.__gwtStatsEvent ? function (a) { ....
>>> var $strongName = '6D7BE6648CA01BEDC1B199CE04D6BBCD';
>>> var
>>> Lcom_google_gwt_core_client_impl_StackTraceCreator$Collector_2_classLit =
>>> createForClass(37);
>>> var
>>> Lcom_google_gwt_core_client_impl_StackTraceCreator$CollectorLegacy_2_classLit
>>> = createForClass(18);
>>> var
>>> Lcom_google_gwt_core_client_impl_StackTraceCreator$CollectorModern_2_classLit
>>> = createForClass(19);
>>
>>
>> Is it an issue that the GWT generates never-used variables ?
>>
>>
>> Thanks
>>
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/19737425-edc4-47c7-8eab-e78d070f7c51%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAPVRV7ecKXsH6CK%3DxU%3DrvN93m2O619jX_xQuEH9WD4q2c3dbzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to