Skip to content

Instantly share code, notes, and snippets.

View davidbarsky's full-sized avatar

David Barsky davidbarsky

View GitHub Profile
thread 'rustc' panicked at /rustc/03ee4845197ce71aa5ee28cb937a3e863b18b42f/compiler/rustc_query_system/src/query/plumbing.rs:729:9:
Found unstable fingerprints for evaluate_obligation(706e470e2fd309c4-4d37fc1b2d5b1225): Ok(EvaluatedToAmbig)
stack backtrace:
0: 0x11289e870 - std::backtrace::Backtrace::create::hb590ce1df6e0c5d2
1: 0x1106f6880 - <alloc[1d87e522c0a46f8e]::boxed::Box<rustc_driver_impl[f43468dcf4e255f1]::install_ice_hook::{closure#0}> as core[c817e82c16756310]::ops::function::Fn<(&dyn for<'a, 'b> core[c817e82c16756310]::ops::function::Fn<(&'a std[833b918185a27e46]::panic::PanicHookInfo<'b>,), Output = ()> + core[c817e82c16756310]::marker::Sync + core[c817e82c16756310]::marker::Send, &std[833b918185a27e46]::panic::PanicHookInfo)>>::call
2: 0x1128b8fdc - std::panicking::rust_panic_with_hook::h93934aa8c7e2fe39
3: 0x1128b8c18 - std::panicking::begin_panic_handler::{{closure}}::h2437105b3c13b3a1
4: 0x1128b6818 - std::sys::backtrace::__rust_end_short_back
@davidbarsky
davidbarsky / main.rs
Created June 25, 2024 14:33
Load `rust-project.json` fast
use clap::Parser;
use rayon::iter::{ParallelBridge, ParallelIterator};
use rustc_hash::{FxHashMap, FxHashSet};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use walkdir::WalkDir;
#[derive(clap::Parser, Debug, PartialEq)]
struct Opt {
path: PathBuf,
(lldb) thread backtrace all
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x000000018802b62c libsystem_kernel.dylib`__ulock_wait + 8
frame #1: 0x000000018806c49c libsystem_pthread.dylib`_pthread_join + 608
frame #2: 0x000000010155ddc4 rust-analyzer`std::sys::pal::unix::thread::Thread::join::hf9819b5e1c4eb05e + 24
frame #3: 0x000000010040f000 rust-analyzer`std::thread::JoinInner$LT$T$GT$::join::h71706a1aa50149a9 + 32
frame #4: 0x000000010042259c rust-analyzer`jod_thread::JoinHandle$LT$T$GT$::join::h519d9c89f867ea72 + 56
frame #5: 0x0000000100426f80 rust-analyzer`rust_analyzer::with_extra_thread::h6e67b23e8c0fcce7 + 244
frame #6: 0x00000001003ea384 rust-analyzer`rust_analyzer::main::hab46c9de6ebd61c6 + 2660
frame #7: 0x0000000100459b0c rust-analyzer`std::sys_common::backtrace::__rust_begin_short_backtrace::h331e3c9bcc7965cf + 12
(lldb) thread backtrace all
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x000000018802b62c libsystem_kernel.dylib`__ulock_wait + 8
frame #1: 0x000000018806c49c libsystem_pthread.dylib`_pthread_join + 608
frame #2: 0x000000010155ddc4 rust-analyzer`std::sys::pal::unix::thread::Thread::join::hf9819b5e1c4eb05e + 24
frame #3: 0x000000010040f000 rust-analyzer`std::thread::JoinInner$LT$T$GT$::join::h71706a1aa50149a9 + 32
frame #4: 0x000000010042259c rust-analyzer`jod_thread::JoinHandle$LT$T$GT$::join::h519d9c89f867ea72 + 56
frame #5: 0x0000000100426f80 rust-analyzer`rust_analyzer::with_extra_thread::h6e67b23e8c0fcce7 + 244
frame #6: 0x00000001003ea384 rust-analyzer`rust_analyzer::main::hab46c9de6ebd61c6 + 2660
frame #7: 0x0000000100459b0c rust-analyzer`std::sys_common::backtrace::__rust_begin_short_backtrace::h331e3c9bcc7965cf + 12
574ms handle_completion
28ms CompletionContext::new
14ms CompletionContext::analyze
14ms Semantics::analyze_impl (2 calls)
0ms SourceBinder::to_module_def (2 calls)
0ms body_with_source_map_query
0ms crate_def_map:wait (5 calls)
0ms crate_def_map:wait (6 calls)
0ms generic_params_query (2 calls)
14ms infer:wait @ detail = "new" (2 calls)
<details>
<summary> </summary>
```
783ms handle_completion
30ms CompletionContext::new
13ms CompletionContext::analyze
13ms Semantics::analyze_impl (2 calls)
13ms infer:wait @ detail = "new" (2 calls)
13ms infer_query
#![deny(rust_2018_idioms)]
/// This is a example showing how information is scoped with tokio's
/// `task::spawn`.
///
/// You can run this example by running the following command in a terminal
///
/// ```
/// cargo run --example tokio-spawny-thing
/// ```
use futures::stream::{FuturesUnordered, StreamExt};

Items:

  1. Better usage docs/examples. The invocation context is accessible through the INVOCATION_CTX task-local which should be documented in examples and documenation. https://github.com/awslabs/aws-lambda-rust-runtime/blob/master/lambda/src/lib.rs#L95-L97. Note that due to limitations in Tokio's task local implementation, subtasks of the invocation task (which is what we run for customers) can't access this task-local. This is a tempoary limitation.
  2. Use tracing for internal logging/instrumentation. Each interaction with the Runtime APIs should be a debug_span! and spawning a new task should a debug_span!. davidbarky@ should handle this.
  3. Slightly refactor the simulated endpoint logic to be driven by an Rng rather than a hard-coded UUID.
    1. We should add an init_failure simulated endpoint and propogate tasks out.
    2. The path routing logic can be cleaned up a bit more by using recently-stabilized Rust features.
@davidbarsky
davidbarsky / ec2-benchmarking.txt
Created November 16, 2019 02:26
Ran on an c3.8xlarge; significantly less background noise.
tracing/tracing-subscriber on  david/downcast_ref-registry is 📦 v0.1.5 via v1.39.0
❯ cargo bench --bench=fmt
Finished release [optimized] target(s) in 0.09s
Running /local/home/dbarsky/Developer/tracing/target/release/deps/fmt-a1a7fd83bd4e2201
Gnuplot not found, disabling plotting
new_span/single_thread/1
time: [542.32 ns 542.57 ns 542.80 ns]
thrpt: [1.8423 Melem/s 1.8431 Melem/s 1.8439 Melem/s]
change:
time: [+1.5380% +1.6310% +1.7080%] (p = 0.00 < 0.05)
@davidbarsky
davidbarsky / Criterion.txt
Created November 16, 2019 00:58
Performance Impact of Downcasting to Registry on Close
Running /Users/dbarsky/Developer/Rust/tracing/target/release/deps/filter-1f05138b0829f7a9
static/baseline_single_threaded
time: [109.35 ns 110.75 ns 112.28 ns]
change: [-19.618% -12.070% -3.7712%] (p = 0.01 < 0.05)
Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
2 (2.00%) high mild
2 (2.00%) high severe
static/single_threaded time: [59.616 ns 60.292 ns 61.067 ns]
change: [-43.963% -36.500% -27.781%] (p = 0.00 < 0.05)