DEV Community

Olimpio
Olimpio

Posted on

Is just me or Gatsby is slow?

gatsby develop takes times to run than jekyll serve or I'm just tripping?🌝

Top comments (19)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I would love to see if SSG support incremental builds, especially from headless CMS's and WordPress API (and dev.to API).

This should be a solution to slow build times. Gosh, everyone knows that Android build time is much slower...

And your clients doesn't care about your slow build times, anyway.

Collapse
 
mjgs profile image
Mark Smith

How do incremental builds work?

If you are pulling data from APIs in building a static site are there certain types of APIs that handle incremental builds in a better way?

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

An idea is updated timestamp.

Another idea is a SHA hash of JSON.stringify with sort keys.

But, I know no such API.

Thread Thread
 
mjgs profile image
Mark Smith

Yeah I was thinking that a hash of the content would be the easiest way to identify changes quickly, but how would APIs present this data?

Feels like a kind of complicated thing to implement, like file sync but for API data.

Thread Thread
 
mjgs profile image
Mark Smith

I did a bit more reading about this. I found this relevant stack overflow post.

It seems like there are a few approaches, but generally speaking record a last-modified timestamp and send this in an API response header, so clients only download data when new stuff has been added. I guess the API could also have a feature to only send back the new stuff when a last-modified timestamp is part of the request.

Worth considering these types of features imo when building APIs that are intended to be used in jamstack environments.

Thread Thread
 
rhymes profile image
rhymes

@patarapolw theoretically if the API supports proper HTTP caching it would work, the problem is that most generic HTTP libraries do not respect caching headers by default so it's a non starter :D

Thread Thread
 
mjgs profile image
Mark Smith

Not if you are building your own client :)
There is such a massive gain in terms of optimisation that it would become worthwhile quite quickly.

Collapse
 
ben profile image
Ben Halpern

I'd love to see a benchmark on the build times across static site generators. Definitely a worthy head-to-head comparison. Not a lot of other features are quite as quantifiable.

Collapse
 
rhymes profile image
rhymes

Just found out there are 460 static site generators so it's probably a job in itself to write a benchmark :D

The only benchmark I'm aware of is Hugo vs Jekyll: Benchmarked:

We ran two tests to measure build times with Hugo and Jekyll. The basic test used the default installation of Jekyll and Hugo to build sites with 10 posts,100 posts, 1,000 posts and 10,000 posts. The advanced test built those same sites but included common plugins and template code in order to create a similar set of features between the two Static Site Generators. For each build, Hugo proved to be between 23 and 63 times faster than Jekyll!

The article also refers to Smashing Magazine having switched from Wordpress to Hugo + Netlify with build times of 13 seconds for 7500 pages.

Hugo itself shows the following video on its homepage in which they build a 5000 pages blog in 6 seconds:

Collapse
 
rnrnshn profile image
Olimpio

This is so amazing... Man, 5k pages in 5s💀😦😦😦...

Collapse
 
mustafaanaskh99 profile image
Mustafa Anas

It is not just you 🙂

Collapse
 
rnrnshn profile image
Olimpio

Damn... Thought I was tripping, but how do u cope with this?

Collapse
 
mustafaanaskh99 profile image
Mustafa Anas

I don't :/
Somethings in life you just gotta bear handling. Like my laptop being a turtle and the current quarantine lol.

Thread Thread
 
rnrnshn profile image
Olimpio

LOL... Indeed... U're right

Collapse
 
remotesynth profile image
Brian Rinaldi

Personally, yes, I agree. In fact, Jekyll used to be criticized for this but has made enormous improvements in this area. I tend to favor Hugo partly for this reason - it is blazing fast. The fact that it is written in Go, shouldn't be a concern for most folks as all you need to learn is the templating - and you can still use your frontend framework if you want.

Collapse
 
pavelloz profile image
Paweł Kowalski

Yeah, i guess for performance reasons Hugo is getting more popular by the day.

Collapse
 
banzyme2 profile image
ENDEESA

Guess I am not allowed to rant because it free....(but wow!)

Collapse
 
rnrnshn profile image
Olimpio

Fact. I've tried 11ty too. I'll second that. I haven't tried Hugo but they say it's build time is faster than any other SSG... With Gatsby I even feel like it's slowing my computer too...

Thread Thread
 
talha131 profile image
Talha Mansoor

Yeah, Hugo is definitely the fastest.