Comments (15)
So no, this is not the reason, it is the repeated calls to locate-library which make things so slow, with this change, I get almost the same performances as before:
diff --git a/all-the-icons.el b/all-the-icons.el
index 671037e3b..7f78fd268 100644
--- a/all-the-icons.el
+++ b/all-the-icons.el
@@ -1100,6 +1100,7 @@ Return the icon file name if found."
(fn (all-the-icons--data-name (car mapping))))
(assoc-default (cadr mapping) (funcall fn))))))
+(defvar all-the-icons-svg-library "/home/thierry/elisp/all-the-icons.el/svg/")
(cl-defmacro all-the-icons-define-icon (name alist &key svg-path-finder (svg-doc-processor ''identity) (padding 0))
"Macro to generate functions for inserting icons for icon set NAME.
@@ -1125,7 +1126,7 @@ PADDING is the number of pixels to be applied to the SVG image."
(defun ,(all-the-icons--function-name name) (icon-name &rest args)
(let* ((file-name (all-the-icons--resolve-icon-file-name icon-name ,alist (quote ,name))) ;; remap icons
(size (window-default-font-height))
- (lib-dir (concat (file-name-directory (locate-library "all-the-icons")) ,(format "svg/%s/" name)))
+ (lib-dir (concat all-the-icons-svg-library ,(format "%s/" name)))
(image-path (concat lib-dir ,(or (and svg-path-finder
`(apply ,svg-path-finder file-name lib-dir size args))
'(format "%s.svg" file-name))))
This is of course a dirty patch just to show where the slowdown happens.
from all-the-icons.el.
So probably computing the path of the svg directory one time for all is the way to go.
from all-the-icons.el.
I'm not entirely sure why the difference is so high. Is it because you are running Emacs under WSL? If not, can you provide me with a profiler report?
from all-the-icons.el.
from all-the-icons.el.
from all-the-icons.el.
So even if avoiding locate-library make things much faster, I still see some slowdowns due to stuff being computed at each of the function calls, probably these could be avoided or at least cached (memoized)?
from all-the-icons.el.
@thierryvolpiatto see if eb32540 works better.
About cache, the icons are cached at here. Caching them at the icon set level is going to blow up memory usage tremendously, and introduce more cache invalidation issues I have to deal with in addition to #367 and #368.
Let me know if you can think of other ways to speed up this branch :)
from all-the-icons.el.
from all-the-icons.el.
from all-the-icons.el.
from all-the-icons.el.
from all-the-icons.el.
For reference:
emacs-helm/helm@4a540f5
from all-the-icons.el.
Now helm is working fine with this branch, by using caching where needed I have reduced memory usage and increased speed.
When do you plan merging this branch to master?
from all-the-icons.el.
Don't know, whenever I have some time and brain space :) Feel free to send over a PR if you'd like
from all-the-icons.el.
from all-the-icons.el.
Related Issues (20)
- add major mode icon for mastodon.el HOT 1
- how does all-the-icons handle icons that overlap with ones from another font?
- Support tree-sitter modes
- Add .pcss extension for PostCSS files HOT 1
- The lambda icon for Scheme has uneven height HOT 2
- fast forward merge of pull requests
- Allow customising all possible icons
- Missing parenthesis in snippet "modified-or-read-only"
- all icons broken after update. HOT 8
- svg branch notes HOT 2
- [svg] handle theme changes
- [SVG] All the alists are not availables HOT 7
- [SVG] Storage of svg files HOT 8
- Can not reproduce icons on fedora
- odin-mode is void HOT 1
- all-the-icon doesn't seem to work correctly when displaying folders HOT 1
- Every inserted icon from `all-the-icons` turns into unidentifiable character On restart everytime and When inserted inside emacs-lisp block showing window unable to decode "problematic characters in the buffer".
- all-the-icons not displayed properly in neotree
- Incorrect icons showing on windows for github octicons
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from all-the-icons.el.