Coder Social home page Coder Social logo

zachbray / hashbang Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 7.0 2.09 MB

A collection of libraries for building web and mobile applications. Leverages FunScript for seamless full-stack development in F#. Adheres to Google's standard for crawling ajax websites.

License: Apache License 2.0

Shell 0.20% F# 99.39% C# 0.40%

hashbang's People

Contributors

scitesy avatar zachbray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hashbang's Issues

Slow JavaScript Compilation in Release Build

Hi Zack,

95% of the compilation time is spent in YuiCompressor.Net. The YuiCompressor.Net implementation uses ArrayLists in way which makes it extremely inefficient when the JavaScript to be compressed contains a large number of short identifiers.

Compilation times on my system and resulting file sizes (the entire HashBang file - HTML + CSS + JavaScript) (release build, 023f8a4):

  1. Funscript( compression: on) ~2s, 0.92 MB
  2. Funscript( compression: off) ~2 s, 1.27 MB
  3. Funscript( compression: on) + YuiCompressor.Net: ~38s, 0.72 MB
  4. Funscript( compression: off) + YuiCompressor.Net: ~7s, 1.0 MB

While it is true that option3 (the one currently in use in release mode) achieves the best compression, I am thinking the performance cost is unacceptable - especially in the current scenario, in which the compilation is performed at site start-up.

As an aside, note that utilizing the YuiCompressor to compress uncompressed FunScript-generated JavaScript is both slower and less efficient than using FunScript compression exclusively.

I think that modifying the code to only use the compression achieved by Funscript alone is acceptable at this stage (I vote for modifying HashBang to use option 1, until the performance of 3 can be addressed).

Moving forward, I see two long-term solutions:

  1. Optimize YuiCompressor.Net - speaking of which: YuiCompressor.Net fails as of 5385839 (works for 023f8a4 - and I have yet to check at which point it broke).
  2. Improve Funscript's native JavaScript compression

Let me know how you'd like to proceed.

Catalin

CrawlerFriendlyDynamicWebsite on Mono Fails at Runtime

Line 84 of src/TypeInferred.HashBang.Core/Website.fs reads:

use compressor = new GZipStream(memoryStream, level, false)

In Mono this .NET 4.5 constructor signature throws a NotImplementedException. It has a MonoTODO attribute in the Mono source code at:

https://github.com/mono/mono/blob/master/mcs/class/System/System.IO.Compression/GZipStream.cs

My current work around is to change this line to the following implemented constructor signature:

use compressor = new GZipStream(memoryStream, CompressionMode.Compress, false)

This allows the demo to run however at this time, I am uncertain about the implications of the workaround.

Any short instruction on what to compile, run etc to make the samples work?

Made a naive attempt just to start playing and got

Unhandled Exception: System.MissingMethodException: Method not found: 'Microsoft.FSharp.Core.FSharpOption`1<System.Tuple`2<ContentType,TypeInferred.HashBang.TypeMetadata>> TypeInferred.HashBang.HandlerMetadata.get_RequestType()'.
   at TypeInferred.HashBang.DynamicWebsite.Start(DynamicWebsite site)
   at StartupCode$CrawlerFriendlyDynamicWebsite>.$CrawlerFriendlyDynamicWebsite.main@() in C:\data3\mw\HashBang\src\Samples\CrawlerFriendlyDynamicWebsite\CrawlerFriendlyDynamicWebsite\Program.fs:line 141
Press any key to continue . . .

HashBang Fails to Build on Mono < version 3.2.4

Line 140 of src/TypeInferred.HashBang.Core/Website.fs reads:

if metadata.CanCacheResponse then Some CompressionLevel.Optimal

Although this line is correct. Any Mono version below 3.2.4 has a System.IO.Compression.CompressionLevel enum of CompressionLevel.Optional instead of CompressionLevel.Optimal. This is fixed in Mono 3.2.4. The workaround for lower Mono versions is to change line 140 to:

if metadata.CanCacheResponse then Some CompressionLevel.Optional

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.