Skip to content

Slowness/choppy with specific Python syntax #1688

@scop

Description

@scop

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

bat --diagnostic 

Environment variables

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

Config file

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

Compile time information

  • Profile: release
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions