Skip to content

Commit 5af8db0

Browse files
committed
Fix #607: Improve build times drastically
Per @dragos's suggestion, this commit implements a new approach to generate table of contents that uses internally populated Jekyll data structures to speed up listing and matching posts that are from the same category. As categories are only populated by posts and our current tutorials are pages, this commits turns pages into posts and makes sure that their permalinks correspond to the current ones. Build times are now around two minutes, see the following profile information from Jekyll: ``` jvican in /data/rw/code/scala/scala.github.com [11:02:40] > $ bundle exec jekyll serve --profile [±drone-integration ●●●] Configuration file: /data/rw/code/scala/scala.github.com/_config.yml Configuration file: /data/rw/code/scala/scala.github.com/_config.yml Source: /data/rw/code/scala/scala.github.com Destination: /data/rw/code/scala/scala.github.com/_site Incremental build: disabled. Enable with --incremental Generating... Filename | Count | Bytes | Time -------------------------------------------------------------------+-------+-----------+------- _layouts/overview-large.html | 164 | 26568.57K | 92.778 _includes/toc-large.txt | 164 | 23156.00K | 88.934 _layouts/tutorial.html | 199 | 3005.98K | 1.350 _layouts/overview.html | 37 | 1190.86K | 0.953 _includes/tutorial-toc.txt | 199 | 267.11K | 0.455 es/overviews/index.md | 1 | 46.66K | 0.443 _includes/localized-overview-index.txt | 1 | 46.49K | 0.443 _includes/tutorial-tour-list.txt | 200 | 244.89K | 0.432 _includes/header.txt | 439 | 2114.25K | 0.347 _layouts/cheatsheet.html | 6 | 225.08K | 0.217 _includes/cheatsheet-sidebar.txt | 6 | 42.70K | 0.207 style/index.md | 1 | 68.00K | 0.184 _includes/footer.txt | 449 | 855.91K | 0.175 tutorials/index.md | 1 | 54.34K | 0.168 _includes/footerbar.txt | 458 | 767.51K | 0.116 _includes/topbar.txt | 419 | 822.04K | 0.110 _includes/pager.txt | 363 | 27.10K | 0.079 _layouts/sip.html | 29 | 626.83K | 0.079 _layouts/guides-index.html | 4 | 55.73K | 0.069 _includes/disqus.txt | 386 | 324.89K | 0.044 _layouts/sip-landing.html | 10 | 171.17K | 0.038 _includes/toc.txt | 66 | 17.62K | 0.034 _layouts/default.html | 261 | 29198.78K | 0.030 _includes/allsids.txt | 10 | 17.88K | 0.019 _layouts/index.html | 7 | 261.62K | 0.011 _includes/sips-topbar.txt | 39 | 31.73K | 0.008 sips/pending/_posts/2016-01-11-static-members.md | 1 | 10.23K | 0.004 _includes/index-header.txt | 7 | 53.96K | 0.004 _includes/cheatsheet-header.txt | 6 | 57.92K | 0.003 _layouts/contribute.html | 1 | 21.40K | 0.003 _includes/frontpage-footer.txt | 9 | 15.29K | 0.003 sips/sip-list.md | 1 | 3.19K | 0.003 sips/completed/_posts/2016-06-25-trailing-commas.md | 1 | 10.62K | 0.002 _layouts/news-coursera.html | 1 | 26.31K | 0.002 _layouts/frontpage.html | 1 | 13.17K | 0.002 _layouts/page.html | 1 | 14.69K | 0.002 _layouts/glossary.html | 1 | 65.08K | 0.002 _layouts/search.html | 1 | 12.77K | 0.002 _includes/contributing-header.txt | 2 | 12.13K | 0.001 sips/minutes-list.md | 1 | 0.76K | 0.001 ja/overviews/collections/concrete-mutable-collection-classes.md | 1 | 13.02K | 0.001 overviews/collections/concrete-mutable-collection-classes.md | 1 | 11.09K | 0.001 ja/overviews/collections/overview.md | 1 | 8.73K | 0.001 _includes/header-coursera.txt | 1 | 5.21K | 0.001 _includes/frontpage-header.txt | 1 | 4.94K | 0.001 es/overviews/parallel-collections/concrete-parallel-collections.md | 1 | 13.97K | 0.001 overviews/parallel-collections/concrete-parallel-collections.md | 1 | 12.57K | 0.001 sips/sip-template.md | 1 | 4.30K | 0.001 overviews/collections/concrete-immutable-collection-classes.md | 1 | 14.17K | 0.001 _includes/glossary-header.txt | 1 | 10.10K | 0.001 done in 123.422 seconds. ```
1 parent ee72508 commit 5af8db0

36 files changed

+42
-13
lines changed

Diff for: _includes/tutorial-tour-list.txt

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
{% for pg in site.pages %}
2-
{% if pg.tutorial == "scala-tour" and pg.outof and pg.language == page.language %}
3-
{% assign totalPagesTour = pg.outof %}
4-
{% endif %}
5-
{% endfor %}
1+
{% assign sorted_tour_posts = site.categories.tour | sort: 'num' %}
2+
{% assign tour_posts_size = sorted_tour_posts | size %}
63

7-
{% if totalPagesTour %}
4+
{% if tour_posts_size %}
85
<ul>
9-
{% for i in (1..totalPagesTour) %}
10-
{% for pg in site.pages %}
11-
{% if pg.tutorial == "scala-tour" and pg.num and pg.num == i and pg.language == page.language %}
6+
{% for pg in sorted_tour_posts %}
7+
{% if pg.language == page.language %}
128
<li class="tour-of-scala {% if page.title == pg.title %} current-page {% endif %}">
139
<a href="{{ pg.url }}">{{ pg.title }}</a>
1410
</li>
1511
{% endif %}
1612
{% endfor %}
17-
{% endfor %}
1813
</ul>
1914
{% else %} **ERROR**. Couldn't find the total number of pages in this set of tutorial articles. Have you declared the `outof` tag in your YAML front matter?
2015
{% endif %}

Diff for: _layouts/tutorial.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
layout: default
2+
layout: post
3+
permalink: /tutorials/:categories/:title/
34
---
45
{% include header.txt %}
56
<div class="wrapper">
@@ -10,8 +11,8 @@
1011

1112
<div class="span10">{% if page.title %}<h1>{{ page.title }}</h1>{% else %}<h1>{{ site.title }}</h1>{% endif %}</div>
1213

13-
{% for pg in site.pages %}
14-
{% if pg.tutorial == "scala-tour" and pg.languages %}
14+
{% for pg in site.categories.tour %}
15+
{% if pg.languages %}
1516
{% assign languages = pg.languages %}
1617
{% endif %}
1718
{% endfor %}

Diff for: tutorials/tour/abstract-types.md renamed to tutorials/tour/_posts/2017-02-13-2017-02-13-abstract-types.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Abstract Types
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 23
910
next-page: compound-types
1011
previous-page: inner-classes

Diff for: tutorials/tour/annotations.md renamed to tutorials/tour/_posts/2017-02-13-annotations.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Annotations
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 32
910
next-page: default-parameter-values
1011
previous-page: automatic-closures

Diff for: tutorials/tour/anonymous-function-syntax.md renamed to tutorials/tour/_posts/2017-02-13-anonymous-function-syntax.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Anonymous Function Syntax
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 7
910
next-page: higher-order-functions
1011
previous-page: mixin-class-composition

Diff for: tutorials/tour/automatic-closures.md renamed to tutorials/tour/_posts/2017-02-13-automatic-closures.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Automatic Type-Dependent Closure Construction
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 31
910
next-page: annotations
1011
previous-page: operators

Diff for: tutorials/tour/basics.md renamed to tutorials/tour/_posts/2017-02-13-basics.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Basics
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 2
910
next-page: unified-types
1011
previous-page: tour-of-scala

Diff for: tutorials/tour/case-classes.md renamed to tutorials/tour/_posts/2017-02-13-case-classes.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Case Classes
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 11
910
next-page: pattern-matching
1011
previous-page: currying

Diff for: tutorials/tour/classes.md renamed to tutorials/tour/_posts/2017-02-13-classes.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Classes
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 4
910
next-page: traits
1011
previous-page: unified-types

Diff for: tutorials/tour/compound-types.md renamed to tutorials/tour/_posts/2017-02-13-compound-types.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Compound Types
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 24
910
next-page: explicitly-typed-self-references
1011
previous-page: abstract-types

Diff for: tutorials/tour/currying.md renamed to tutorials/tour/_posts/2017-02-13-currying.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Currying
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 10
910
next-page: case-classes
1011
previous-page: nested-functions

Diff for: tutorials/tour/default-parameter-values.md renamed to tutorials/tour/_posts/2017-02-13-default-parameter-values.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Default Parameter Values
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 33
910
next-page: named-parameters
1011
previous-page: annotations

Diff for: tutorials/tour/explicitly-typed-self-references.md renamed to tutorials/tour/_posts/2017-02-13-explicitly-typed-self-references.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Explicitly Typed Self References
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 25
910
next-page: implicit-parameters
1011
previous-page: compound-types

Diff for: tutorials/tour/extractor-objects.md renamed to tutorials/tour/_posts/2017-02-13-extractor-objects.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Extractor Objects
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 16
910
next-page: sequence-comprehensions
1011
previous-page: regular-expression-patterns

Diff for: tutorials/tour/generic-classes.md renamed to tutorials/tour/_posts/2017-02-13-generic-classes.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Generic Classes
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 18
910
next-page: variances
1011
previous-page: sequence-comprehensions

Diff for: tutorials/tour/higher-order-functions.md renamed to tutorials/tour/_posts/2017-02-13-higher-order-functions.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Higher-order Functions
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 8
910
next-page: nested-functions
1011
previous-page: anonymous-function-syntax

Diff for: tutorials/tour/implicit-conversions.md renamed to tutorials/tour/_posts/2017-02-13-implicit-conversions.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Implicit Conversions
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 27
910
next-page: polymorphic-methods
1011
previous-page: implicit-parameters

Diff for: tutorials/tour/implicit-parameters.md renamed to tutorials/tour/_posts/2017-02-13-implicit-parameters.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Implicit Parameters
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 26
910
next-page: implicit-conversions
1011
previous-page: explicitly-typed-self-references

Diff for: tutorials/tour/inner-classes.md renamed to tutorials/tour/_posts/2017-02-13-inner-classes.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Inner Classes
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 22
910
next-page: abstract-types
1011
previous-page: lower-type-bounds

Diff for: tutorials/tour/local-type-inference.md renamed to tutorials/tour/_posts/2017-02-13-local-type-inference.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Local Type Inference
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 29
910
next-page: operators
1011
previous-page: polymorphic-methods

Diff for: tutorials/tour/lower-type-bounds.md renamed to tutorials/tour/_posts/2017-02-13-lower-type-bounds.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Lower Type Bounds
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 21
910
next-page: inner-classes
1011
previous-page: upper-type-bounds

Diff for: tutorials/tour/mixin-class-composition.md renamed to tutorials/tour/_posts/2017-02-13-mixin-class-composition.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Mixin Class Composition
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 6
910
next-page: anonymous-function-syntax
1011
previous-page: traits

Diff for: tutorials/tour/named-parameters.md renamed to tutorials/tour/_posts/2017-02-13-named-parameters.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Named Parameters
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 34
910
previous-page: default-parameter-values
1011
---

Diff for: tutorials/tour/nested-functions.md renamed to tutorials/tour/_posts/2017-02-13-nested-functions.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Nested Functions
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 9
910
next-page: currying
1011
previous-page: higher-order-functions

Diff for: tutorials/tour/operators.md renamed to tutorials/tour/_posts/2017-02-13-operators.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Operators
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 30
910
next-page: automatic-closures
1011
previous-page: local-type-inference

Diff for: tutorials/tour/pattern-matching.md renamed to tutorials/tour/_posts/2017-02-13-pattern-matching.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Pattern Matching
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 12
910

1011
next-page: singleton-objects

Diff for: tutorials/tour/polymorphic-methods.md renamed to tutorials/tour/_posts/2017-02-13-polymorphic-methods.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Polymorphic Methods
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 28
910

1011
next-page: local-type-inference

Diff for: tutorials/tour/regular-expression-patterns.md renamed to tutorials/tour/_posts/2017-02-13-regular-expression-patterns.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Regular Expression Patterns
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 15
910

1011
next-page: extractor-objects

Diff for: tutorials/tour/sequence-comprehensions.md renamed to tutorials/tour/_posts/2017-02-13-sequence-comprehensions.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Sequence Comprehensions
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 17
910
next-page: generic-classes
1011
previous-page: extractor-objects

Diff for: tutorials/tour/singleton-objects.md renamed to tutorials/tour/_posts/2017-02-13-singleton-objects.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Singleton Objects
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 13
910

1011
next-page: xml-processing

Diff for: tutorials/tour/tour-of-scala.md renamed to tutorials/tour/_posts/2017-02-13-tour-of-scala.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Introduction
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 1
910
languages: [ba, es, ko, pt-br, pl]
1011
outof: 34

Diff for: tutorials/tour/traits.md renamed to tutorials/tour/_posts/2017-02-13-traits.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Traits
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 5
910
next-page: mixin-class-composition
1011
previous-page: classes

Diff for: tutorials/tour/unified-types.md renamed to tutorials/tour/_posts/2017-02-13-unified-types.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Unified Types
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 3
910
next-page: classes
1011
previous-page: basics

Diff for: tutorials/tour/upper-type-bounds.md renamed to tutorials/tour/_posts/2017-02-13-upper-type-bounds.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Upper Type Bounds
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 20
910
next-page: lower-type-bounds
1011
previous-page: variances
File renamed without changes.

Diff for: tutorials/tour/xml-processing.md renamed to tutorials/tour/_posts/2017-02-13-xml-processing.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: XML Processing
55
disqus: true
66

77
tutorial: scala-tour
8+
categories: tour
89
num: 14
910
next-page: regular-expression-patterns
1011
previous-page: singleton-objects

0 commit comments

Comments
 (0)