cdepillabout / servant-static-th

Embed a directory of static files in your application and serve them from your Servant server
http://hackage.haskell.org/package/servant-static-th
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

Fix slow js compile #2

Closed cdepillabout closed 7 years ago

cdepillabout commented 7 years ago

This should fix the slow JS compile times.

Before this change, JS files were being read in as a ByteString and turned into a [Word8]. Because the ByteString is like 100kb, this becomes a very long [Word8]. I think GHC was taking a long time to compile this.

This PR changes it so that JS files are read in as a ByteString, but decoded to a UTF8 String. I don't think that it is alright to assume that JS files are UTF8-encoded, but I'm not sure of the best way to represent an array of arbitrary bytes (a ByteString) in a Haskell src file.

@arowM Can you test this out and make sure it is working?

cdepillabout commented 7 years ago

@arowM I've given you access to this repository, as well the hackage page: https://hackage.haskell.org/package/servant-static-th

If you confirm that this PR is working for you, feel free to update the version number, create a new git tag, and upload to hackage.

arowM commented 7 years ago

It reduces compile time dramatically. Thanks a lot.