Sunday, July 1, 2012

Optimizing Mundlejs: Cacheing the dependency parse

Update- Blog moved to: http://saleemabdulhamid.com/blog/2012/7/optimizing-mundlejs-cacheing-the-dependency-parse

Introduction

Following my previous efforts at establishing a baseline benchmark for mundlejs, I took my first step at optimization. Previously, the contents of every javascript file requested were parsed for dependencies. This occurred on every request from a different client. As of this commit, the direct dependencies of each file are cached, so the next time that file is requested, it is not necessary to parse the file again. This is a precursor to being able to pre-parse all files prior to beginning to serve files, which will be one of the features of the "deploy mode." Because we don't have cluster support built in yet, in the benchmarks below all parses are done 8 times (or however many cores are on the testing machine), since the cache is not shared between worker processes yet.

Results

We're still not on the same order of magnitude as Apache and Connect, but there was a significant improvement. The little dip at one data point is probably just an artifact of something else that was happening on my machine at the same time. I don't think I'll be exploring it further, preferring to spend my time on the next step in optomization.

No comments:

Post a Comment