# language: Optimize language_for_file \(\#28671\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/98891e4c702badb4c9323a8f9bd4354b53938408)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 98891e4c702badb4c9323a8f9bd4354b53938408

Requested commit: 98891e4c702badb4c9323a8f9bd4354b53938408

Commit: 98891e4c702badb4c9323a8f9bd4354b53938408

Tree: 22da74eeef45dd2b9ff4491219c4e8fdc927545b

Author: Piotr Osiewicz

Committer: GitHub

## Message

```
language: Optimize language_for_file (#28671)

While working on #28670 this function showed up in my profiles; this PR
makes it evaluate some of it's conditions lazily + prevent constant
rebuilding of globset::Candidates.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
```

## Parents

- [5e57f148acd05da412df80b55fe26171d268d9b0](https://git.cafe/gitcafe/zed/commit/5e57f148acd05da412df80b55fe26171d268d9b0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/98891e4c702badb4c9323a8f9bd4354b53938408?format=markdown)
