Files
openidea/crates/ide-workspace/examples/open_large.rs
l0ng-ai 1e00ea5ee2 feat: Third pass aligning core experience with IntelliJ IDEA
Project & files
- Project view modes (Project Files / Open Files / All Changed Files /
  Scratches); External Libraries for Python, JDK (src.zip), Node, Cargo, Go,
  Maven/Gradle jars; read-only jar/zip browsing
- ⌘N New popup with type search and more file kinds; New Project, Rename
  Project, Reload All from Disk, Export/Import Settings, Power Save Mode
- File type associations, extra content roots and exclude patterns (indexed
  and watched without reopening the project)

Editor & navigation
- Find bar: search scope (comments/strings), Preserve Case, Exclude, multiline,
  history; Find in Files: Module scope, custom pattern scopes, multiline
- Search Everywhere filters, Assign Shortcut, settings results; named bookmark
  lists, file/folder bookmarks; Structure filters and Show Inherited; Recent
  Locations timestamps and breadcrumbs; Code Vision author
- Completion options, editor tab placement/layout, inline completion (LSP 3.18)
- Spell checking (Typo inspection, ide-spell) and Inspections settings with
  custom profiles; Code Style schemes, formatter markers, Do not format

Run, VCS, services, database
- Typed run configurations (Shell, Program, npm, Gradle, Maven, Docker,
  Compound), Modify options, Before launch, env dialog, Current File,
  Emulate terminal (PTY)
- Git log graph/view options, Go to Hash/Branch/Tag, date filter keeps the
  graph; Pull/Merge/Rebase dialogs, Manage Remotes, Worktrees
- Generic Services host (Docker connections/registries, run sessions); TODO
  scope/changes tabs with changelists; Coverage report import
- Data sources: wire-compatible vendors, URL import, SSL certs, Options,
  Schemas and Advanced tabs, color and comment

Workbench
- Run Anything, Customize Main Toolbar, named tool window layouts, menu
  completeness, Code Cleanup, macros, "Don't Show Again", editor banners
- Chinese translations for the new UI

Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
2026-10-25 21:24:00 +08:00

39 lines
1.5 KiB
Rust

//! `cargo run --release -p ide-workspace --example open_large [MiB]`: time and
//! peak-memory cost of opening a large file as a document (default 100 MiB).
use ide_core::{LanguageId, NullSink};
use ide_workspace::Documents;
use ide_workspace::process::resident_bytes;
use std::sync::Arc;
use std::time::Instant;
fn main() {
let mib: usize = std::env::args().nth(1).and_then(|a| a.parse().ok()).unwrap_or(100);
let dir = std::env::temp_dir().join(format!("openidea-open-large-{}", std::process::id()));
std::fs::create_dir_all(&dir).expect("temp dir");
let path = dir.join("big.log");
let line = "2026-10-20T12:00:00Z INFO request served path=/api/v1/items id=12345 é\n";
let text = line.repeat(mib * 1024 * 1024 / line.len());
std::fs::write(&path, &text).expect("write");
drop(text);
let docs =
Documents::new(Arc::new(NullSink), Box::new(|_: &std::path::Path, _: Option<&str>| LanguageId::plain_text()));
let rss0 = resident_bytes().unwrap_or(0);
let t = Instant::now();
let info = docs.open(&path).expect("open");
let open = t.elapsed();
let rss1 = resident_bytes().unwrap_or(0);
let t = Instant::now();
let json = serde_json::to_string(&info).expect("json");
let ser = t.elapsed();
println!(
"{mib} MiB: open {open:?}, serialize for IPC {ser:?} ({} MiB JSON), large={}, read_only={}, rss +{} MiB after open",
json.len() >> 20,
info.large,
info.read_only,
(rss1.saturating_sub(rss0)) >> 20
);
let _ = std::fs::remove_dir_all(&dir);
}