Skip to content

Commit

Permalink
Improves TraitMap performance. (#6471)
Browse files Browse the repository at this point in the history
## Description

By using im::Vector inside TypeMap we avoid cloning everything when
cloning namespaces.

Improves TraitMap not to traverse all entries.

These changes incur a performance **increase** in the compilation time.
The benchmark compile takes 40% less time to run.

Fixes #6470.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Joshua Batty <[email protected]>
Co-authored-by: IGI-111 <[email protected]>
  • Loading branch information
3 people authored Aug 28, 2024
1 parent e85dffc commit 4fc554c
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 62 deletions.
2 changes: 1 addition & 1 deletion forc-plugins/forc-lsp/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A simple `forc` plugin for starting the sway language server.
//!
//! Once installed and available via `PATH`, can be executed via `forc lsp`.

#![recursion_limit = "256"]
// Use Jemalloc for main binary
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
Expand Down
2 changes: 2 additions & 0 deletions sway-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![recursion_limit = "256"]

#[macro_use]
pub mod error;

Expand Down
Loading

0 comments on commit 4fc554c

Please sign in to comment.