Huge output files

Bug #1284811 reported by Jan Hruby
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cheerp
Fix Released
High
Unassigned

Bug Description

For your example program dom1 that is compiled with :
clang++ -O3 -target duetto dom1.cpp -o test1.js

I got from 419 bytes of original code 2.03 MB of compiled javascript. That seems to me a bug.

It looks like that the standard library code is included in the output. It should be posible to get rid of it by using static analysis and dead code elemination.

Revision history for this message
Jan Hruby (jhruby-web) wrote :

As I see it there is an optimization that should be done.

It should be eliminated partial string construction. It does not make much sense to me. At the compile time you already know what string is going to be constructed.

It will reduce code size also.

Changed in duetto:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Alessandro Pignotti (a-pignotti) wrote :

Up to now we have been focused on producing correct code and we just started working to optimize the generated code from the size point of view. You can use a regular JavaScript minimizer to reduce the code size. In the future duetto will directly generate minimized code.

Duetto already uses static analysis to only compile what is actually used. The part of the standard library that you see is the one which initializes C++ iostream functionalities and it's always included and executed even on regular platform. We plan to add a smarter analysis to handle this case as well.

About the string code, you've spotted an optimization that we have already planned to do. Generally speaking expect improvements on this area since improving code side (and performance) is one of our focus now that duetto is mature enough to be used on real world code.

Changed in cheerp:
status: Confirmed → Fix Committed
Changed in cheerp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.