Skip to main content

parse_speed/
main.rs

1use std::{fs, time};
2
3use html_languageservice::{HTMLDataManager, HTMLLanguageService, HTMLLanguageServiceOptions};
4use lsp_textdocument::FullTextDocument;
5
6fn main() {
7    let content = fs::read_to_string("examples/parse-speed/index.html").unwrap();
8
9    let document = FullTextDocument::new("html".to_string(), 0, content);
10
11    let start_time = time::SystemTime::now();
12    let ls = HTMLLanguageService::new(&HTMLLanguageServiceOptions::default());
13    ls.parse_html_document(&document, &HTMLDataManager::default());
14    let end_time = time::SystemTime::now();
15    let duration = end_time.duration_since(start_time).unwrap();
16    // vscode-languageservice time: 55ms
17    println!("{:?}", duration);
18}