Monday, August 11, 2014

Its alive! livereloading I mean

Last few weeks, I've been working on a nifty approach to get livereloading of e.g. templates at runtime within D. But I've had quite a few problems along the way. Let me explain.

Majority of livereload code base was written semi easily (although did one partial rewrite woops). However dependency management wasn't so easy.

The methods I tried was:

  1. Get dmd to output interface files to all the dependencies and have a binary library to link in
    This failed for a one main reason, link. Basically what appears to be happening is the path being generated for the output files isn't correct. Its also similar to another bug report link. Which has lead me to believe that this hasn't ever been experienced before. Or somebody broke it semi recently (release wise).
  2. Using dub to handle generation of the project AND use its describing capabilities to make sure its valid.
    This failed because it wasn't taking into account a lot of the logic used when building.
  3. Bolting livereload on top of dub itself.
    In essence injecting the appropriate flags into dub's build process based upon the appropriate sub packages.
The last one, was very successful.
But one thing I have noticed. If you were to reference vibe inside a compilation module, it'll take about 3 times as long. This is ridiculous. For a non vibe referencing code its about 1.5 seconds. Which is more than acceptable.

Using a minimal type of importing for requestHTTP it still took around 3 seconds. But that was still an improvement.
With just a logInfo it was 1 and half seconds. Now this is much better.
What this means is there is a lot of overhead for networking. This could be split off into separate libraries. Which should help with making this a lot faster!

This is a very great start, but the performance is a little bit of a worry for me even when its in release mode (dmd). At this point, I don't think dub itself is slowing it done.

Update:
Those times are screwed as they include the execution time. This to me is very positive stance!
Compilation is actually between 700ms-1.6s. So really all not bad.

No comments:

Post a Comment