cmderdev / cmderdev/cmder

[Question] Executing `printf` command is very slow

Open
#3,017 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

❔ Type: Question
Dominant language
PowerShell
Stars
27k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Version Information
Cmder version: Version 1.3.25.328
Operating system: 
Edition Windows 11 Pro
Version: 23H2
Processor: 13th Gen Intel(R) Core(TM) i9-13950HX   2.20 GHz
Installed RAM: 64.0 GB (63.7 GB usable)
Cmder Edition

Cmder Full (with Git)

Description of the issue

cmder take around 2 to 3 senconds to execute the printf command see the screenshot and the log file taken from debug feature:

Image

cmder debug.csv

How to reproduce

I have a batch script that prints valid custom "profiles" that I created for my work. It took a lot of time to print the whole table. I can share with you an example.

`@echo off
setlocal
call colors.bat

ECHO.
printf "%IPurple%Valid Profiles are:%Full_Color_Reset%"
ECHO.
printf "-----------------------------------------------\n"
printf "|     Profile     |          Proyect          |\n"
printf "-----------------------------------------------\n"
printf "|LRD ------------> L. & R. Distributors, Inc  |\n"
printf "|etrain ---------> Dematic's Etrain           |\n"
printf "|ELI-LILLY-CON---> Elli Lilly Concord         |\n"
printf "|Eli-Lilly-RTP --> Elli Lilly RTP             |\n"
printf "|Eli-Lilly-IDAP -> Elli Lilly Indianapolis    |\n"
printf "|ACE ------------> ACE Hardware               |\n"
printf "|GRI ------------> Groupe Robert Inc.         |\n"
printf "|loblaw ---------> Loblaw.                    |\n"
printf "|AMC ------------> Americold.                 |\n"
printf "|CE -------------> Cooper Electric.           |\n"
printf "|CEMD -----------> Capital Electric MD.       |\n"
printf "|NC -------------> North Coast.               |\n"
printf "|HH -------------> Home Hardware.             |\n"
printf "-----------------------------------------------\n"
ECHO.
printf "%IYellow%example:%Full_Color_Reset%"
ECHO.
rem // Store current code page in a variable for later restore (optional):
for /F "tokens=2 delims=:" %%C in ('chcp') do set /A "$CP=%%C"
rem // Change code page to UTF-8 Unicode:
chcp 65001 > nul
printf "%IWhite%λ%Full_Color_Reset% switchCmderProfile GRI"
rem // Restore original code page (optional):
chcp %$CP% > nul
ECHO.

endlocal`

Additional context

This started to happen suddenly, this problem started a couple of weeks ago, the terminal is executed with admin rights all the time

Checklist
  • I have read the documentation.
  • I have searched for similar issues and found none that describe my issue.
  • I have reproduced the issue on the latest version of Cmder.
  • I am certain my issues are not related to ConEmu, Clink, or other third-party tools that Cmder uses.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied batch script and reviewing the attached cmder.debug.csv to compare the timing of each printf invocation. Done means identifying the cause of the 2–3 second delay and validating a fix against the same profile output.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.