Skip to content

[Bug]: Performance Issue - bufferline Consumes Excessive CPU Time #959

@apollo1321

Description

@apollo1321

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

I've observed that when I open a substantial number of buffers (around 30), Neovim becomes unresponsive. Upon closing all the hidden buffers, performance improves significantly. To diagnose the issue, I created a flamegraph, which revealed that "bufferline" is consuming 70% processing time, which is more than all my ~30 other plugins combined together.

out

What did you expect to happen?

I expect "bufferline" to be lightweight and efficient, ideally consuming around 1% of CPU time, similar to how "lualine" performs.

Config

local bufferline = require("bufferline")

bufferline.setup({
  options = {
    numbers = "none",
    offsets = {
      {
        filetype = "NvimTree",
        text = "NvimTree",
        highlight = "Directory",
        text_align = "center",
        separator = true
      }
    },
    style_preset = bufferline.style_preset.minimal,
  },
  highlights = {
    fill = {
      bg = spec.bg0
    },
    background = {
      fg = syn.comment,
      bg = spec.bg0
    },
    tab = {
      fg = spec.bg3,
      bg = spec.bg0
    },
    tab_selected = {
      fg = spec.bg0,
      bg = spec.bg0
    },
    tab_separator = {
      fg = spec.diag.info,
      bg = spec.bg0
    },
    tab_separator_selected = {
      fg = spec.diag.info,
      bg = spec.bg1
    },
    tab_close = {
      fg = spec.diag.error,
      bg = spec.bg0
    },
    close_button = {
      fg = spec.diag.error,
      bg = spec.bg0
    },
    close_button_visible = {
      fg = spec.diag.error,
      bg = spec.bg0
    },
    close_button_selected = {
      fg = spec.diag.error,
      bg = spec.bg1
    },
    buffer_visible = {
      fg = spec.fg1,
      bg = spec.bg0
    },
    buffer_selected = {
      fg = spec.fg0,
      bg = spec.bg1,
      bold = true,
      italic = true,
    },
    error = {
      fg = spec.diag.error,
      bg = spec.diag.error
    },
    error_diagnostic = {
      fg = spec.diag.error,
      bg = spec.diag.error
    },
    modified = {
      fg = spec.diag.hint,
      bg = spec.bg0
    },
    modified_visible = {
      fg = spec.diag.hint,
      bg = spec.bg0
    },
    modified_selected = {
      fg = spec.diag.hint,
      bg = spec.bg1
    },
    separator_selected = {
      fg = spec.diag.info,
      bg = spec.bg1
    },
    separator_visible = {
      fg = spec.diag.info,
      bg = spec.bg0
    },
    separator = {
      fg = spec.diag.info,
      bg = spec.bg0
    },
    indicator_selected = {
      fg = spec.bg1,
      bg = spec.bg1
    },
    offset_separator = {
      fg = spec.bg0,
      bg = spec.bg1
    },
  },
})

Additional Information

...

commit

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions