atom-community / atom-community/tool-bar

[Performance] improve atom.tooltips.add

Open
#307 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
160
Forks
47
PR merge metrics
No merged PRs in 30d

Description

You would be surprised if you know that most of the time spent for creating the buttons, is spent in adding the tooltips to them! We might want to write a faster version of the original
https://github.com/suda/tool-bar/blob/937f75719a1002af5b207c073b6e45dd82617f44/lib/items/tool-bar-button-view.js#L121

https://github.com/atom/atom/blob/e4b9c1e0815c5c07514a0649e7ebb9b5226a2931/src/tooltip-manager.js#L113-L181

For 30 buttons, this becomes ~6ms.

Details

![image](https://user-images.githubusercontent.com/16418197/84225922-009fff00-aaa6-11ea-853f-9626da839aef.png)

Which is almost the same as the whole time spent on the buttons:

Details

![image](https://user-images.githubusercontent.com/16418197/84226270-f2061780-aaa6-11ea-9778-ea9a52c7a4ed.png)

I am going to port the function to our package and see if I can write a faster version.

Contributor guide

Open the contributing guide

Research direction

Compare lib/items/tool-bar-button-view.js at the referenced line with Atom's src/tooltip-manager.js implementation around lines 113-181. Benchmark toolbar creation with 30 buttons, then verify the faster tooltip path preserves the existing behavior and improves on the reported ~6ms cost.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.