Leanify icon indicating copy to clipboard operation
Leanify copied to clipboard

This pull request introduces library feature for leanify.

Open doterax opened this issue 3 years ago • 5 comments

Useful feature to increase optimization speed.

Use case one.

I have several projects that shares common resources. In my case five projects built for different platforms. That projects shares a lot of texture atlases. And I need to leanify them all. Leanifying one project takes 20 minutes. For five projects it will take something around 100 minutes. This is bad. With library feature, I need 20 minutes to fill library first time, following leanifying just reuse already compressed data and copy it.

Use case two.

I made pre-master build of web application and leanified it with library enabled. And during final test I find small bug and should rebuid application again.With library feature re-leanifying of my web application is fast as file copy.

Use case three.

I will be able to setup incremental leanifying of my projects just add leanify with enabled library in post build. First build will be slow, but next one will fast.

By default library feature is disabled.

To enable it use -l switch followed by path to library.

For example to leanify everything in current directory with custom library folder just use this command:

leanify -l c:\leanify_library .

or

leanify -l ~\leanify_library .

If you don't care about place for your library folder, just use * symbol

Example:

leanify -l * .

This will use global library folder in temp directory.

Full path to library will be printed in terminal.

WARNING! Library folder always grows, leanify never delete anything, you should clean it from time to time.

Bonus! Library feature also works in parallel mode.

Note:

Library use SHA1 hash of input file content to find already leanifyed data. So if you started leanifying with enabled library on folder that contains already leanifyed data, you did not noticed speed increase this is because library contains only hashes of source files. And this action doubles library size.

doterax avatar May 12 '21 12:05 doterax

Hi, thanks for the PR, but I don't think this feature should be part of leanify, either whatever code calling leanify or a standalone wrapper is a more suitable place, something like ccache.

JayXon avatar May 14 '21 00:05 JayXon

Thank you for answer. I also share same doubts about this feature in leanify. I played with self writed cache that use leanify to process. But after severall experiments I come up with idea that cache feature should be in leanify. This is best for overall processing speed, because no overhead for interprocess communications at all.

Also library feature is optional and won't break existing workflows.

So I will be happy to make it part of such great tool.

doterax avatar May 14 '21 08:05 doterax

I doubt the interprocess overhead matters much in this case. Also this feature seems very specific to your use case, I doubt that this is useful to the general leanify user. I don't think I've seen any precedence of such cache feature in any of the file optimization tools.

JayXon avatar May 16 '21 03:05 JayXon

Hi @JayXon, I have merged master and fixed some conflicts. And it will be nice if you apply this PR. We have been used this feature in our company for a year+ and it greatly increased our productivity when we apply leanify to a built project. And no matter how huge is build, every next build and following leanifying is very fast.

Thank you in advance.

doterax avatar Oct 13 '22 20:10 doterax

@JayXon can you reconsider your opinion on this PR?

doterax avatar Dec 15 '22 20:12 doterax