-
Notifications
You must be signed in to change notification settings - Fork 93
Make icon rendering go faster #48
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
base: master
Are you sure you want to change the base?
Conversation
The script no longer creates a new inkscape process for every png export. Instead a single inkscape process is created for each svg-file and export commands are simply fed to it. This allows for using multiple CPU-cores and avoids the cost of constantly starting up inkscape. The script no longer renders out the entire icon set each time it's run, instead it updates only icons which have been changed since the last time the script finished running. This also means if the script is interrupted while rendering, any svg-files what was finished will not render out again saving time.
The stream of inkscape commands have been divided across multiple instances of inkscape, one per core. This speeds up rendering by using more cpu cores, even for single svg rendering. To do this a simple java program was written which starts N instances of whatever arguments was passed to it and then reads one line at the time from standard input, the lines are then divided into N seperate streams which are then piped to the the difference instances of whatever program was passed as argument to SplitJob.
Instead of rendering out everything in an svg-file, the render script now takes in a regular expression that is uses to search all the object-IDs inside each of the svg-files for a match and only renders those. To make the search go faster all object-IDs are stored in files named ".<svg-file-name>.cache" after every full render of an svg-file or if none exist.
|
Hi, |
All cache and timestamp files are now in a single directory named .cache avoiding clutter in the src directory and makes delete cache files easier.
|
@NicoHood Can't really create a pull request (easily) since that is not a fork in github's eyes, but a complete reupload. Notice if doesn't say fork underneath the repo's name. Anyway if you want these commits you can simply do the merge manually yourself in your local git repo then pushing the results. Just make sure the author (me) is preserved in the commit. I hope you will push for changes in the icon theme as it hasn't seen changes for two years now. If there is anything else I can do to help make the process of developing new icons of the theme just ask (implying it's something you will actually work on). |
|
This PR adds a new dependency, java, right? Can't we use something like gnu-parallel instead? This would not require this large dependency and we are already using it for the arc-theme. |
|
@NicoHood Maybe but I don't know how, maybe there is some GNU parallel guru or maybe just bash guru that can make it work. Parallel seem to create a new instance of inkscape instead of reusing a existing one which I assume would actually make things slower, not faster. |
I really like the Arc theme and use it on my personal computer, however e.g. a lot of MIME types are missing. I've created a few myself, mostly related to java, however the rendering script is really slow and makes it hard to test the icons out. This pull-request mostly includes my changes to render_icons.sh and should make the rendering script run faster. On my machine rendering out the entire icon set from scratch takes about 6 times less time than it would have previously.
My machine:
Ubuntu 16.04
Intel Core i5-4670K CPU @ 3.40GHz × 4
8 GB of RAM.
It also now skips any svg-files that haven't changed since the last render finished. That's what the _timestamp files are for, they keep track of when the svg was render out last so we have something to compare time with.
Another neat feature for speeding things up a bit is the ability to filter out which icons should be rendered. Just pass the render script a regular expression and only objects with matching IDs will get rendered out. E.g. the example below only takes about 3 seconds to finish rendering. Combine this with something like
sudo cp -ruv ../Arc /usr/share/icons/and it allows for deploying an icon change in 5 seconds, though not all apps will register the changes necessarily and changing icon theme back and forth might be required.One caveat though is that search only looks for object-IDs in the cached object-ID files. So if new icons are created with new object-IDs, you need to delete the cache file and then a new cache file will be created instead, like
rm .actions.cache. Another option is just to run the render script with no arguments and it should automatically detect that the corresponding svg-file has changed and render it out as well as create a new cache file.The cache files are also great for searching which icons you currently have. Example.
I know there hasn't been any commits recently to this repository, however I hope you will keep working on the Arc theme and this should hopefully make you more productive or at least help anyone else wanting to continue working on this icon theme.
PS: I removed optipng as I had no idea what it was doing in the original script, so you might want to add it back.