Posts: 21
Threads: 4
Joined: Apr 2020
Reputation:
0
Location: Poland
Hi,
I have IntraWeb 15.1.20 Ultimate with source code (Subscription to 2021).
Is it possible to optimize final HTML code? (I would like to remove characters #9 and #13#10)
I'm trying with WebApplication.Response in the IWUserSessionBaseAfterExecuteForm event, but I can't get to ContentStream.
Probably only solution is to add something to source code.
Posts: 2,299
Threads: 202
Joined: Mar 2018
Reputation:
87
Location: Auckland, New Zealand
04-24-2020, 04:56 AM
(This post was last modified: 04-24-2020, 05:05 AM by Alexandre Machado.)
What's the reason for that?
Believe me, whatever feeling you may have that it will improve things don't hold against any performance test.
Even the fastest text parser on earth is not able to remove enough chars from it to a point that it will be faster to parse/optimize/transmit than increasing your compression ratio in ServerController.Compression.Level setting.
One example:
I ran a random IW project which is open now on my IDE. Size of the HTML:
Original: 3316
Optimized (using online HTML minifier): 2718
Gain = 18%
Now, I gzipped both using maximum compression:
Original: 1,456 (1,466 using fastest)
Optimized: 1,324 (1,329 using fastest)
The difference is now only 9%. Also notice that using fastest compression I get almost exactly the same result. Have in mind that fastest compression, especially in x64 uses extra-optimized Cloudflare gzip compression which is the fastest available in the (Delphi) world.
The difference tends to be smaller when the file size increases (~ 5-7%). Whatever performance gain you may think you will have with, say, 10% of reduction of the traffic will be
pulverized by the CPU cycles spent by the parser/optimizer.
Posts: 227
Threads: 4
Joined: Mar 2018
Reputation:
22
04-24-2020, 09:14 PM
(This post was last modified: 04-24-2020, 09:15 PM by DanBarclay.)
You may want to obfuscate your js code during build. That also means you only do it once, and none at runtime.
For changing/killing the "generator" string, there is an event for that. See IWServerControllerBaseMetaTag()
Dan