NLKNguyen / papercolor-theme

:art: Light & Dark Vim color schemes inspired by Google's Material Design

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why papercolor fast to load.

glepnir opened this issue · comments

@NLKNguyen Thanks for your greate work. I used to use papercolor for a long time.
Now I made a new colorscheme oceanic-material, reference papercolor #28 , I refactor it, But there is still a gap between speed with papercolor.
Thanks a lot for any help

Thanks :) What I realized after many refactors is this https://github.com/NLKNguyen/papercolor-theme/blob/master/colors/PaperColor.vim#L903 Basically reduce function calls and especially if-branches inside those calls because those are very slow. That also means reduce object getters for the color codes to the minimum.

Btw, you can leverage all of PaperColor for your own color scheme like this example https://github.com/NLKNguyen/papercolor-blue I never got a chance to write documentation for it, but essentially, PaperColor can turn into to any color theme with all optimization and syntax colors.

Thank you very much for your reply. I got these revelations from this issue, so I removed a lot of if, but it is still slower than papercolor, I just added an if to determine whether the variable is enabled.

@glepnir Wow, Gleipnir!

@NLKNguyen Thanks. now I got the same speed as papercolor-theme. Close issue.

Awesome! Congrats!