Skip to content

Conversation

@chrjen
Copy link

@chrjen chrjen commented Sep 3, 2017

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.

Minutes Seconds
Original 20 30
Current 3 20

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.

$ ./render_icons.sh cpp
Rendering objects with IDs matching regex
Match: text-x-cpp_16
Match: text-x-cpp_22
Match: text-x-cpp_24
Match: text-x-cpp_32
Match: text-x-cpp_48
Match: text-x-cpp_64
Match: text-x-cpp_96
Match: text-x-cpp_128

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.

$ grep generic .*.cache | sed -r 's/\_[0-9]+//' | sort | uniq
.mimetypes.cache:audio-x-generic
.mimetypes.cache:font-x-generic
.mimetypes.cache:image-x-generic
.mimetypes.cache:package-x-generic
.mimetypes.cache:text-x-generic
.mimetypes.cache:video-x-generic

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.

chrjen added 3 commits August 31, 2017 00:44
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.
@NicoHood
Copy link

NicoHood commented Sep 7, 2018

Hi,
similar to the arc-theme we created a new fork to maintain this icon theme further. Please post your PR here:
https://github.com/NicoHood/arc-icon-theme

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.
@chrjen
Copy link
Author

chrjen commented Sep 7, 2018

@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).

@NicoHood
Copy link

NicoHood commented Sep 8, 2018

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.

@chrjen
Copy link
Author

chrjen commented Sep 8, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants