GithubHelp home page GithubHelp logo

Improve performance about chalk HOT 4 CLOSED

chalk avatar chalk commented on May 23, 2024
Improve performance

from chalk.

Comments (4)

sindresorhus avatar sindresorhus commented on May 23, 2024

Yes, you're probably better off using https://github.com/sindresorhus/ansi-styles for high-performance situations. It will probably be faster than colors too.

Though I'll keep this open to remind me about doing a perf review of Chalk. There might be some optimizations to be made.

from chalk.

CrabDude avatar CrabDude commented on May 23, 2024

Thanks for the recommendation. I'll take a look.

from chalk.

ccheever avatar ccheever commented on May 23, 2024

@CrabDude I made an alternate implementation that might be faster. It should be a drop-in replacement for chalk and work exactly the same way.

https://github.com/aceface/crayon

Can you try running it on your codebase and see if things run faster? If you don't a ton of chaining, it should be significantly faster (turning 100000 simple strings red was 31ms vs 7s with chalk for me)

@sindresorhus take a look at the code. In general, I think the defineProps for every style each time there is a call is what is slow, but would have to measure more to be sure.

from chalk.

CrabDude avatar CrabDude commented on May 23, 2024

Definitely. I'll try it out this weekend and report back.

On Friday, May 23, 2014, Charlie Cheever [email protected] wrote:

@CrabDude https://github.com/CrabDude I made an alternate
implementation that might be faster. It should be a drop-in replacement for
chalk and work exactly the same way.

https://github.com/aceface/crayon

Can you try running it on your codebase and see if things run faster? If
you don't a ton of chaining, it should be significantly faster (turning
100000 simple strings red was 31ms vs 7s with chalk for me)

@sindresorhus https://github.com/sindresorhus take a look at the code.
In general, I think the defineProps for every style each time there is a
call is what is slow, but would have to measure more to be sure.


Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-44069929
.

from chalk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.