Compare commits
No commits in common. "21e1ceb8e0daf8b12d4d09fab9a2e69d7a5558ec" and "8561fdc1bdf4ecc3dbbff81dcd25361d03c6947a" have entirely different histories.
21e1ceb8e0
...
8561fdc1bd
10
Cargo.toml
10
Cargo.toml
@ -40,16 +40,10 @@ tracing-subscriber = { version = "0.3.17", optional = true, features = ["env-fil
|
|||||||
walkdir = "2.3.3"
|
walkdir = "2.3.3"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["compare"]
|
default = ["compare", "tracing"]
|
||||||
compare = []
|
compare = []
|
||||||
tracing = ["dep:opentelemetry", "dep:opentelemetry-otlp", "dep:opentelemetry-semantic-conventions", "dep:tokio", "dep:tracing", "dep:tracing-opentelemetry", "dep:tracing-subscriber"]
|
tracing = ["dep:opentelemetry", "dep:opentelemetry-otlp", "dep:opentelemetry-semantic-conventions", "dep:tokio", "dep:tracing", "dep:tracing-opentelemetry", "dep:tracing-subscriber"]
|
||||||
|
|
||||||
[profile.release-lto]
|
[profile.release]
|
||||||
inherits = "release"
|
|
||||||
lto = true
|
lto = true
|
||||||
strip = "symbols"
|
strip = "symbols"
|
||||||
|
|
||||||
[profile.perf]
|
|
||||||
inherits = "release"
|
|
||||||
lto = true
|
|
||||||
debug = true
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
cd "$DIR/../"
|
|
||||||
|
|
||||||
RUSTFLAGS="-C opt-level=0" cargo build --no-default-features
|
|
||||||
valgrind --tool=callgrind --callgrind-out-file=callgrind.out target/debug/compare
|
|
||||||
|
|
||||||
echo "You probably want to run:"
|
|
||||||
echo "callgrind_annotate --auto=yes callgrind.out"
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
: ${PROFILE:="perf"}
|
|
||||||
|
|
||||||
cd "$DIR/../"
|
|
||||||
|
|
||||||
cargo build --profile "$PROFILE" --no-default-features
|
|
||||||
perf record --freq=2000 --call-graph dwarf --output=perf.data target/${PROFILE}/compare
|
|
||||||
# Convert to a format firefox will read
|
|
||||||
# flags to consider --show-info
|
|
||||||
perf script -F +pid --input perf.data > perf.firefox
|
|
||||||
|
|
||||||
echo "You probably want to go to https://profiler.firefox.com/"
|
|
||||||
echo "Either that or run hotspot"
|
|
12
src/main.rs
12
src/main.rs
@ -1,6 +1,8 @@
|
|||||||
#![feature(round_char_boundary)]
|
#![feature(round_char_boundary)]
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
use ::organic::parser::document;
|
use ::organic::parser::document;
|
||||||
#[cfg(feature = "compare")]
|
#[cfg(feature = "compare")]
|
||||||
use organic::compare_document;
|
use organic::compare_document;
|
||||||
@ -35,10 +37,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn main_body() -> Result<(), Box<dyn std::error::Error>> {
|
fn main_body() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
#[cfg(not(feature = "compare"))]
|
||||||
|
let org_contents = "";
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
let org_contents = read_stdin_to_string()?;
|
let org_contents = read_stdin_to_string()?;
|
||||||
run_compare(org_contents)
|
run_compare(org_contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
fn read_stdin_to_string() -> Result<String, Box<dyn std::error::Error>> {
|
fn read_stdin_to_string() -> Result<String, Box<dyn std::error::Error>> {
|
||||||
let mut stdin_contents = String::new();
|
let mut stdin_contents = String::new();
|
||||||
std::io::stdin()
|
std::io::stdin()
|
||||||
@ -73,9 +79,7 @@ fn run_compare<P: AsRef<str>>(org_contents: P) -> Result<(), Box<dyn std::error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "compare"))]
|
#[cfg(not(feature = "compare"))]
|
||||||
fn run_compare<P: AsRef<str>>(org_contents: P) -> Result<(), Box<dyn std::error::Error>> {
|
fn run_compare<P: AsRef<str>>(_org_contents: P) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
eprintln!("This program was built with compare disabled. Dumping the AST from rust.");
|
println!("This program was built with compare disabled. Doing nothing.");
|
||||||
let (remaining, rust_parsed) = document(org_contents.as_ref()).expect("Org Parse failure");
|
|
||||||
println!("{:#?}", rust_parsed);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user