Skip to content
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

Use hard links #884

Closed
torrentkino opened this issue Mar 25, 2013 · 11 comments
Closed

Use hard links #884

torrentkino opened this issue Mar 25, 2013 · 11 comments
Labels
frozen-due-to-age support This is a question about Jekyll's usage.

Comments

@torrentkino
Copy link

Hello,

I have an enhancement request:

Please use "hard links" while creating _site whenever possible. That is fast and does not need additional disk space. Tons of images and HTML5 videos could be "copied" to _site in no time.

Kind regards,
Aiko Barz

@parkr
Copy link
Member

parkr commented Mar 25, 2013

We do copy over static files and generate posts and pages in _site as you specify.

@parkr parkr closed this as completed Mar 25, 2013
@parkr
Copy link
Member

parkr commented Mar 25, 2013

Perhaps you could clarify if you didn't mean this?

@torrentkino
Copy link
Author

I meant, use
ln big_static_file.huge _site/big_static_file.huge
instead of
cp big_static_file.huge _site/big_static_file.huge

http://en.wikipedia.org/wiki/Hard_link

@parkr
Copy link
Member

parkr commented Mar 25, 2013

Oh, use symlinks! This is problematic when we use the site to deploy. Even doing a simple copy-with-my-ftp-client would most likely not be compatible with this feature. :-(

@torrentkino
Copy link
Author

Actually, I did not mean a symlink. I meant a hardlink. :)

A symlink would be represented by:
ln -s big_static_file.huge _site/big_static_file.huge

@mattr-
Copy link
Member

mattr- commented Mar 25, 2013

No, not symlinks either. Hardlinks are a totally different thing and — if I
remember correctly — work well with the whole copy-with-my-ftp-client use
case.

I think it's worth trying, at least for Unix based systems. I don't believe
Windows supports hard links

@maul-esel
Copy link

I don't believe Windows supports hard links

Im pretty sure it does.

@mattr-
Copy link
Member

mattr- commented Mar 25, 2013

Awesome. I was not aware of this. I only knew about junctions. (not a windows expert, at all)

@mattr-
Copy link
Member

mattr- commented Mar 27, 2013

@parkr @mojombo I think we should reopen this. The use of hard links would massively speed up site generation. Thoughts?

@parkr
Copy link
Member

parkr commented Mar 28, 2013

Seems like it'd be involved. Want to throw together a PR and put that up? I'm not sure it's worth the juggling, especially considering we're working on an incremental regeneration solution which will make regeneration even faster.

@ke352802081770314
Copy link

I have deployed jekyll recently, and very soon I was wondering why hardlinks are not used for assets, primarily due to disk space, but not having to lug many megabytes of data around would certainly speed up the build process too.
Incremental regeneration addresses build time, but the waste of space by systematically keeping all assets double on disk remains. Also incremental builds are not always a solution, if a site contains tag clouds, most recent posts and whatever in a sidebar of every page as is common in blogs, only a full generate will result in a consistent and appealing web presence.

Anyway, unfortunately I can't contribute any code as I don't speak ruby, so I can only make suggestions.
I verified by searching that ruby offers a "link" method for files which generates the hardlink: http://ruby-doc.org/core-1.9.3/File.html#method-c-link
It says it is not implemented on all platforms, which leaves it unclear whether it was implemented for Windows or not (yet).
Both on Unix and Windows, hard links only work within the same file system, so depending on the setting of the _config.yml item "destination", they may or may not work. So, the approach has to be:

if (file is an asset i.e. is to be placed in destination unprocessed)
try File.link(sourcefile, destinationfile)
if that didn't work, copy sourcefile to destinationfile (as before)

Needless to say, I would appreciate if implementing this could be reconsidered. Many thanks.

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age support This is a question about Jekyll's usage.
Projects
None yet
Development

No branches or pull requests

6 participants