jorgebucaran / colorette

🌈Easily set your terminal text color & styles
MIT License
1.61k stars 51 forks source link

Use faster-than-regex .substring() slicing #84

Closed jorgebucaran closed 3 years ago

jorgebucaran commented 3 years ago

This improves runtime performance when clearing bleeding sequences, using .substring() rather than regexes.

This clever idea is inspired by @alexeyraspopov's replaceClose function in picocolors. Thank you for that! 🙌

codecov-commenter commented 3 years ago

Codecov Report

Merging #84 (57d4fad) into main (eba26cd) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #84   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          133       147   +14     
=========================================
+ Hits           133       147   +14     
Impacted Files Coverage Δ
index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update eba26cd...57d4fad. Read the comment docs.

ai commented 3 years ago

Add mentions about inspiration to docs?

kibertoad commented 3 years ago

@jorgebucaran I think that's a good idea. Let's add a section dedicated to credits and honourable mentions.

jorgebucaran commented 3 years ago

That's a great idea. Done in 6a4a871! 💯

ai commented 3 years ago

@jorgebucaran https://github.com/jorgebucaran/colorette/commit/6a4a871e5953e8538c2a606eb62b9c1d664ad284 will be better by adding explicit link to chalk and picocolors’s mention and link.

jorgebucaran commented 3 years ago

I'm pretty happy with the result, actually, but I'll definitely consider your suggestion. Thanks!

alexeyraspopov commented 3 years ago

The acknowledgment sounds like it was my contribution to this project, which it wasn’t.

I don’t mind adopting performance tricks.

I would really appreciate if you could update this section with proper links to the projects. Would be even better if the section wasn’t buried somewhere down the page. Thanks

jorgebucaran commented 3 years ago

Sure, I can think of another way to acknowledge you. 👌

kibertoad commented 3 years ago

@alexeyraspopov We ended up listing reference in release notes next to a specific change, which seems more appropriate, since this is a one-off optimization and not something fundamental to how Colorette is built. Agreed on readme notes making it sound like it was contributed by you directly. Would you prefer us rephrasing, or removing it and just keeping release notes?

alexeyraspopov commented 3 years ago

I’d prefer adding links to the projects, as I mentioned previously.

kibertoad commented 3 years ago

Yup, we are adding links for sure, give us a bit of time :)

jorgebucaran commented 3 years ago

Absolutely. Added in ada9fb377685c45e6cee6aa4acd636a9ab5fdf93. 👍