Skip to content

Commit

Permalink
Merge pull request #1779 from radixdlt/feature/faster-ra-in-main
Browse files Browse the repository at this point in the history
Improve Rust Analyzer's performance on the main branch
  • Loading branch information
0xOmarA authored Apr 22, 2024
2 parents 868ba44 + e81e060 commit d5ce4d1
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 27 deletions.
3 changes: 1 addition & 2 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ runs:
# Switch to more recent LLVM/Clang 15.0.7
# see: https://github.com/actions/runner-images/blob/macOS-12/20240105.3/images/macos/macos-12-Readme.md
run: echo "$(brew --prefix llvm@15)/bin" >> $GITHUB_PATH
shell: bash

shell: bash
4 changes: 3 additions & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ concurrency:
jobs:
benchmark:
name: Run bench
runs-on: gh-runner-scrypto-ubuntu-jammy-16-cores
runs-on: ubuntu-16-cores-selfhosted
permissions:
pull-requests: write
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [gh-runner-scrypto-ubuntu-jammy-16-cores]
os: [ubuntu-16-cores-selfhosted]
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -143,7 +143,7 @@ jobs:

radix-engine:
name: Run Radix Engine tests
runs-on: gh-runner-scrypto-ubuntu-jammy-16-cores
runs-on: ubuntu-16-cores-selfhosted
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -165,7 +165,7 @@ jobs:
# - overflow-checks
# which are false for release variant
name: Run Radix Engine tests (release)
runs-on: gh-runner-scrypto-ubuntu-jammy-16-cores
runs-on: ubuntu-16-cores-selfhosted
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -182,7 +182,7 @@ jobs:
radix-engine-no-std:
name: Run Radix Engine tests (no_std)
runs-on: gh-runner-scrypto-ubuntu-jammy-16-cores
runs-on: ubuntu-16-cores-selfhosted
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -199,7 +199,7 @@ jobs:
radix-engine-wasmer:
name: Run Radix Engine tests (wasmer)
runs-on: gh-runner-scrypto-ubuntu-jammy-16-cores
runs-on: ubuntu-16-cores-selfhosted
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [gh-runner-scrypto-ubuntu-jammy-16-cores, windows-latest-16-cores]
os: [ubuntu-16-cores-selfhosted, windows-16-cores-selfhosted]
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -287,7 +287,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [gh-runner-scrypto-ubuntu-jammy-16-cores, windows-latest-16-cores, macos-latest]
os: [ubuntu-16-cores-selfhosted, windows-16-cores-selfhosted, macos-latest]
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -307,7 +307,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [gh-runner-scrypto-ubuntu-jammy-16-cores]
os: [ubuntu-16-cores-selfhosted]
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -320,7 +320,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [gh-runner-scrypto-ubuntu-jammy-16-cores]
os: [ubuntu-16-cores-selfhosted]
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
Expand All @@ -330,7 +330,7 @@ jobs:

determinism-test:
name: Run determinism test
runs-on: gh-runner-scrypto-ubuntu-jammy-16-cores
runs-on: ubuntu-16-cores-selfhosted
steps:
- uses: RDXWorks-actions/checkout@main
- name: Cargo Check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-scrypto-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build-amd:
uses: radixdlt/public-iac-resuable-artifacts/.github/workflows/docker-build.yml@main
with:
runs_on: gh-runner-scrypto-ubuntu-jammy-16-cores
runs_on: ubuntu-16-cores-selfhosted
environment: "release"
image_registry: "docker.io"
image_organization: "radixdlt"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Language for building DeFi apps on Radix.

Documentation: https://docs-babylon.radixdlt.com/main/scrypto/introduction.html
Documentation: https://docs.radixdlt.com/docs/scrypto-1


## Installation
Expand Down
14 changes: 11 additions & 3 deletions radix-engine-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ pub use radix_engine_derive::{
ScryptoDecode, ScryptoEncode, ScryptoEvent, ScryptoSbor,
};

// This is to make derives work within this crate.
// See: https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
pub extern crate self as radix_engine_common;
// extern crate self as X; in lib.rs allows ::X and X to resolve to this crate inside this crate.
// This enables procedural macros which output code involving paths to this crate, to work inside
// this crate. See this link for details:
// https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
//
// IMPORTANT:
// This should never be pub, else `X::X::X::X::...` becomes a valid path in downstream crates,
// which we've discovered can cause really bad autocomplete times (when combined with other
// specific imports, generic traits, resolution paths which likely trigger edge cases in
// Rust Analyzer which get stuck on these infinite possible paths)
extern crate self as radix_engine_common;

/// Each module should have its own prelude, which:
/// * Adds preludes of upstream crates
Expand Down
14 changes: 11 additions & 3 deletions radix-engine-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ pub use radix_engine_common::*;
pub extern crate sbor;
pub use sbor::{Categorize, Decode, Encode, Sbor};

// This is to make derives work within this crate.
// See: https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
pub extern crate self as radix_engine_interface;
// extern crate self as X; in lib.rs allows ::X and X to resolve to this crate inside this crate.
// This enables procedural macros which output code involving paths to this crate, to work inside
// this crate. See this link for details:
// https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
//
// IMPORTANT:
// This should never be pub, else `X::X::X::X::...` becomes a valid path in downstream crates,
// which we've discovered can cause really bad autocomplete times (when combined with other
// specific imports, generic traits, resolution paths which likely trigger edge cases in
// Rust Analyzer which get stuck on these infinite possible paths)
extern crate self as radix_engine_interface;

/// Each module should have its own prelude, which:
/// * Adds preludes of upstream crates
Expand Down
2 changes: 1 addition & 1 deletion radix-engine-tests/tests/vm/stack_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn test_error_enum_sizes() {
print_size!(AccessControllerError);
print_size!(NonFungibleResourceManagerError);

check_size!(RuntimeError, 100);
check_size!(RuntimeError, 116);
check_size!(KernelError, 100);
check_size!(CallFrameError, 100);
check_size!(SystemError, 100);
Expand Down
12 changes: 10 additions & 2 deletions sbor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,16 @@ pub use sbor_derive::{
Describe, Encode, Sbor,
};

// This is to make derives work within this crate.
// See: https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
// extern crate self as X; in lib.rs allows ::X and X to resolve to this crate inside this crate.
// This enables procedural macros which output code involving paths to this crate, to work inside
// this crate. See this link for details:
// https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
//
// IMPORTANT:
// This should never be pub, else `X::X::X::X::...` becomes a valid path in downstream crates,
// which we've discovered can cause really bad autocomplete times (when combined with other
// specific imports, generic traits, resolution paths which likely trigger edge cases in
// Rust Analyzer which get stuck on these infinite possible paths)
extern crate self as sbor;

// For self-contained macros
Expand Down
14 changes: 11 additions & 3 deletions scrypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ pub use radix_engine_interface::{
address, api, blueprints, constants, crypto, data, math, network, schema, time, types,
};

// This is to make derives work within this crate.
// See: https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
pub extern crate self as scrypto;
// extern crate self as X; in lib.rs allows ::X and X to resolve to this crate inside this crate.
// This enables procedural macros which output code involving paths to this crate, to work inside
// this crate. See this link for details:
// https://users.rust-lang.org/t/how-can-i-use-my-derive-macro-from-the-crate-that-declares-the-trait/60502
//
// IMPORTANT:
// This should never be pub, else `X::X::X::X::...` becomes a valid path in downstream crates,
// which we've discovered can cause really bad autocomplete times (when combined with other
// specific imports, generic traits, resolution paths which likely trigger edge cases in
// Rust Analyzer which get stuck on these infinite possible paths)
extern crate self as scrypto;

/// Sets up panic hook.
pub fn set_up_panic_hook() {
Expand Down

0 comments on commit d5ce4d1

Please sign in to comment.