[Pas2js] Executable Size Discussion Nr 2837202 ;)

Michael Van Canneyt michael at freepascal.org
Fri Nov 16 08:41:24 CET 2018



On Fri, 16 Nov 2018, Ulrich, Christian wrote:

> Hi,
>
> I would like to discuss a bit how things can be handled.
> At time I see a lot of effort to copy an Delphi7 Application 1:1 to the Web.
> We make Widgetsets that can be build from the Form Designer with Standard Controls, an implementation of TDataSet is here and so on...
> That results in an Javascript size of ~400kb for an Form with an DBLabel, DB Access and an Button...

We are currently investigating how to reduce the size of the produced
javascript. There are various things that can be done.

The biggest gain is expected to be achieved by removing unnecessary RTTI.
The RTTI is not needed when you build forms dynamically.

But simply renaming private fields/methods/local variables can also improve
the size considerably. (one major drawback is ASM blocks, as the compiler
does not know what they do)

>
> When the Widgetset is build further, in the same manner we will be at 1mb Library Size in near Future.

ExtJS and many other widgetsets arrive at the same size.

>
> I think a lot of "Delphi 7" Stuff is not nessesary in the web. At example TDataSet with full compatibility to Delphi.
> An TWebDataSet that has FieldByName,Insert,Post,Delete... sould be enough.

This is wrong thinking. Please have a look at the ExtJS data store. It's
size and functionality is similar to (if not much bigger than) TDataset.

If you want to offer the same functionality with other mechanisms, you will
quickly end up using frameworks (_underscore, backbone and the like) that 
have a similar footprint when you add them together.

These libraries offer a mix of what is available in Classes, TDataset, sysutils and whatnot.
So you will not gain much IMHO.

But I am open to restructure TDataset so the optimizer (and the optimizer
really does a lot of work) can do an even better job.

> But maybe its way better to use something like anguklar to update DBControls automatically and place just an JSJson Element somewhere and that's it...

As you know, TMS web core is built on pas2js. If anything, the feedback from
end users is that we need MORE delphi compatible libraries. 
People want to be able to drop a TMySQLDataset on their webform, and all should be automagically
transferred to/from some database backend running on whatever server, 
which takes care of REST and whatnot.

These people are really not interested in the size of their webpage JS.

This is not to say that we should not care, far from it. 
I'm just giving a small exerpt from the feedback we get till now.

> The same happens to Controls. We need an Sidebar, Toolbar, Auto arranging Forms (automatic responsive handling of the Controls)
> Is it really the right way to build an Sidebar out of Panels,Toolbars,Listboxes ? Or would it be nicer to have an integrated Component for that, which is also much smaller couse not 4 Controls have to be implemented to get this one usecase.
> Is it really the right way to build Forms out of Edit Fields and Buttons and be in Anchoring hell to get this responsive ? Or would it better to have an integrated Form Component that handles the Edits itself like here: https://docs.dhtmlx.com/form__index.html

IMO the integrated form component is a dead end. Invariably you end up
wishing that you had more control over what it does.

>
> Just things that crosses my mind, and I want to discuss. Please don't see that as an attack to someone“s work. I really like pas2js and the new possibilities.

Do not worry, I don't think people feel attacked. We all want the best
possible development experience&end result.

I think that we need a 2-way approach.

- Provide libraries that make the development experience as close to Delphi/Lazarus RAD as possible.

- Provide a set of libraries that are doing more what Angular,React,Vue are doing. (possibly using wrappers around these libraries)

And if we can make something that allows you to design a webpage in a RAD manner
with the latter libraries: so much the better.

Michael.


More information about the Pas2js mailing list