Skip to content

Commit

Permalink
Reduce runtime expenses for delivering GZip compressed files
Browse files Browse the repository at this point in the history
Expand the `SourceFiles` and `ElmMake` compilation interfaces to support blobs `gzip` encoding at compile time.
Adapt one of the example apps to demonstrate using the new compilation interfaces.
  • Loading branch information
Viir committed Dec 7, 2021
1 parent 37b7241 commit 5a63398
Show file tree
Hide file tree
Showing 12 changed files with 997 additions and 803 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"elm-community/list-extra": "8.2.4",
"elm-community/maybe-extra": "5.2.0",
"elm-community/result-extra": "2.4.0",
"folkertdev/elm-flate": "2.0.5",
"folkertdev/elm-sha2": "1.0.0",
"mdgriffith/elm-ui": "1.1.8",
"stil4m/elm-syntax": "7.2.8",
Expand All @@ -42,4 +43,4 @@
"rtfeldman/elm-iso8601-date-strings": "1.1.3"
}
}
}
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implement/elm-fullstack/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace elm_fullstack;

public class Program
{
static public string AppVersionId => "2021-12-06";
static public string AppVersionId => "2021-12-07";

static int AdminInterfaceDefaultPort => 4000;

Expand Down
4 changes: 2 additions & 2 deletions implement/elm-fullstack/elm-fullstack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>elm_fullstack</RootNamespace>
<AssemblyName>elm-fs</AssemblyName>
<AssemblyVersion>2021.1206.0.0</AssemblyVersion>
<FileVersion>2021.1206.0.0</FileVersion>
<AssemblyVersion>2021.1207.0.0</AssemblyVersion>
<FileVersion>2021.1207.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
882 changes: 490 additions & 392 deletions implement/example-apps/elm-editor/src/CompileFullstackApp.elm

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions implement/example-apps/rich-chat-room/src/Backend/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ updateForHttpRequestEventWithoutPendingHttpRequests httpRequestEvent stateBefore
, bodyAsBase64 =
Just
(if enableInspector then
CompilationInterface.ElmMake.elm_make____src_Frontend_Main_elm.debug.base64
CompilationInterface.ElmMake.elm_make____src_Frontend_Main_elm.debug.gzip.base64

else
CompilationInterface.ElmMake.elm_make____src_Frontend_Main_elm.base64
CompilationInterface.ElmMake.elm_make____src_Frontend_Main_elm.gzip.base64
)
, headersToAdd = []
, headersToAdd = [ { name = "Content-Encoding", values = [ "gzip" ] } ]
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module CompilationInterface.ElmMake exposing (..)
-}


elm_make____src_Frontend_Main_elm : { debug : { base64 : String }, base64 : String }
elm_make____src_Frontend_Main_elm : { debug : { gzip : { base64 : String } }, gzip : { base64 : String } }
elm_make____src_Frontend_Main_elm =
{ base64 = "The compiler replaces this value."
, debug = { base64 = "The compiler replaces this value." }
{ gzip = { base64 = "The compiler replaces this value." }
, debug = { gzip = { base64 = "The compiler replaces this value." } }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ type alias Base64AndUtf8 =
{ utf8 : String, base64 : String }


file__utf8____a_file_txt : String
file__utf8____a_file_txt =
"The compiler replaces this value."


file____a_file_txt : { utf8 : String }
file____a_file_txt : { utf8 : String, gzip : { base64 : String } }
file____a_file_txt =
{ utf8 = "The compiler replaces this value." }
{ utf8 = "The compiler replaces this value."
, gzip = { base64 = "The compiler replaces this value." }
}


file____directory_file_alpha_txt : Base64AndUtf8
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"H4sIAAAAAAAA/wXAMQ0AIAwEQCsvCgfkSUhIWX7ABQsjQqqnBmqh13iEMRfRt4kmxH/ptwAXT/clGAAAAA=="
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CompilationInterface.SourceFiles.file____a_file_txt.gzip.base64

0 comments on commit 5a63398

Please sign in to comment.