5 Replies Latest reply on Jun 28, 2013 6:08 AM by werrenmi

    Generated client marshaller code is large

    werrenmi

      Hello together

       

      Meantime our project is well going on and no more so small, but today i located maybe a problem with the size of the generated code of the marshaller.

       

      The Initial download size of the javascript has reached 4 MB and i tried to determine the biggest parts. And unfortunately is the marshaller the biggest one with 17.x% in each permutation.

       

      At the moment we have 73 dto's they contains 342 properties. The marshaller generates ~2kb  per property.

       

      I know, it's not a small count of dto's, but in our project  we expect ~200 dto's at the end.

       

      You can find the compiler-report attached.

       

      Are they maybe possibilities to optimize this, except to eliminate dto's?

       

      Regards

      Michel

       

      PS. Sorry i forgot, we use Errai 2.2.0.Final

        • 1. Re: Generated client marshaller code is large
          csa

          HI Michel,

           

          Unfortunately, there's no good solution I can recommend right now to make the emitted MarshallerFactoryImpl smaller.

           

          We do have plans to change the way we generate marshallers in Errai. The idea is to generate one separate marshaller class per portable type. Together with incremental generators this should result in a big performance improvement in DevMode and also allow for code splitting. Similiar to the @LoadAsync support we have for IOC (the generated BootstrapperImpl), marshallers could then be partitioned into different split points and the corresponding code could then only be downloaded when needed (in smaller chunks).

           

          I just did a quick round of compile reports on some of our demos and they average a lot lower than 2KB per property. So, there mioght be a specific case that can be optimized. Could you maybe share one of your marshallers? Maybe there's something we can do in the short-term.

           

          Cheers,

          Christian

          • 2. Re: Generated client marshaller code is large
            werrenmi

            Hello Christian

             

            Thanks for your quick respone.

             

            We doesn't use any custom marshaller, i have attached the generated MarshallerFactroyImpl.java, i hope this help.

             

            I tested the difference between 2.2.0.Final and 2.4.0.Beta1 Marshaller. The good thing is ... in 2.4.0.Beta1 the generated Marshaller is significantly smaller, but unfortunately the rpc's in 2.4.0.Beta1 are even slower.

             

            As i remember Mike told a while ago that's the vm param "-Derrai.compile.perf.perform_reachability_analysis=true" is just experimental, but i don't know the exactly sense of it. Because that i tried and see the javascript has shrinked to 1.2MB! ... Unfortunately the application is no more running . Is this responsible to the gwt reachability behavior of gwt?

             

            Regards

            Michel

            • 3. Re: Generated client marshaller code is large
              csa

              Hi Michel,

               

              -Derrai.compile.perf.perform_reachability_analysis=true activates Errai's own reachability analysis which isn't ready for production yet. The motivation for it is that our MarshallerFactoryImpl brings in all portable types and GWT's own reachability analysis can't eliminate these types.

               

              Thanks for sharing your marshaller output. I don't see any pathological case in there. Good thing the marshallers are smaller in 2.4. RPC's should def. not be slower though. We will look into this.

               

              Christian

              1 of 1 people found this helpful
              • 4. Re: Generated client marshaller code is large
                csa

                We have investigated the RPC performance issue. I replied on the relevant thread: https://community.jboss.org/thread/228697

                1 of 1 people found this helpful
                • 5. Re: Generated client marshaller code is large
                  werrenmi

                  Hello Christian

                   

                  Thanks for your help and effort!

                   

                  When the 2.4.0 version becomes final, i will try to migrate our project.

                   

                  Regards

                  Michel