New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache filename-to-item mapping in Sass #821

Merged
merged 1 commit into from Feb 12, 2016

Conversation

Projects
None yet
1 participant
@ddfreyne
Member

ddfreyne commented Feb 12, 2016

This caches the filename-to-item mapping, so that #imported_filename_to_item is significantly faster.

This is a per-site cache, which will stick around in memory, which I feel is okay for now. This could be updated to use WeakRefs.


Compilation speeds without cache:

Site compiled in 14.32s.
Site compiled in 13.85s.
Site compiled in 14.15s.
Site compiled in 15.27s.
Site compiled in 15.52s.

Method profile without cache:

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
      3560  (36.4%)        1778  (18.2%)     Nanoc::Filters::Sass#uncached_imported_filename_to_item
      3220  (34.4%)        1606  (17.2%)     Nanoc::Filters::Sass#uncached_imported_filename_to_item
      3368  (35.7%)        1679  (17.8%)     Nanoc::Filters::Sass#uncached_imported_filename_to_item
      3996  (38.0%)        1990  (18.9%)     Nanoc::Filters::Sass#uncached_imported_filename_to_item
      4630  (42.7%)        2309  (21.3%)     Nanoc::Filters::Sass#uncached_imported_filename_to_item

Compilation speeds with cache:

Site compiled in 12.68s.
Site compiled in 13.23s.
Site compiled in 13.51s.
Site compiled in 13.14s.
Site compiled in 12.51s.

Method profile with cache:

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
        43   (0.5%)          33   (0.4%)     Nanoc::Filters::Sass#cached_imported_filename_to_item
        51   (0.5%)          34   (0.4%)     Nanoc::Filters::Sass#cached_imported_filename_to_item
        40   (0.4%)          33   (0.3%)     Nanoc::Filters::Sass#cached_imported_filename_to_item
        53   (0.6%)          33   (0.4%)     Nanoc::Filters::Sass#cached_imported_filename_to_item
        46   (0.5%)          39   (0.4%)     Nanoc::Filters::Sass#cached_imported_filename_to_item

ddfreyne added a commit that referenced this pull request Feb 12, 2016

Merge pull request #821 from nanoc/cache-sass-filename-mapping
Cache filename-to-item mapping in Sass

@ddfreyne ddfreyne merged commit 2024849 into release-4.1.x Feb 12, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ddfreyne ddfreyne deleted the cache-sass-filename-mapping branch Feb 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment