Slowness/choppy with specific Python syntax · Issue #1688 · sharkdp/bat (original) (raw)

Describe the bug you encountered:

bat consumes 100% of one cpu and gives choppy output (~3 lines per second on my box) for a specific Python sample. Shell reproducer:

{ echo "foo={"; for i in {1..100}; do echo " #'a': '$i',"; done; } | bat --language python

This is sensitive to amount of whitespace within the echo. Adding or removing some might speed it up some, but is still choppy with some other amounts.

What did you expect to happen instead?

Normal smooth output.

How did you install bat?

git master


bat version and environment

Software version

bat 0.18.1 (35f3127-modified)

Operating system

Linux 5.8.0-55-generic

Command-line

Environment variables

SHELL=/bin/bash PAGER=less LESS=-iMR BAT_PAGER='less -R' BAT_CACHE_PATH= BAT_CONFIG_PATH= BAT_OPTS= BAT_STYLE= BAT_TABS= BAT_THEME=Dracula XDG_CONFIG_HOME= XDG_CACHE_HOME= COLORTERM=truecolor NO_COLOR= MANPAGER=

Config file

Could not read contents of '/home/scop/.config/bat/config': No such file or directory (os error 2).

Compile time information

Less version

> less --version 
less 551 (GNU regular expressions)
Copyright (C) 1984-2019  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: http://www.greenwoodsoftware.com/less