html5ever 0.1.0

High-performance browser-grade HTML5 parser
// Copyright 2014 The html5ever Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
//> or the MIT license
// <LICENSE-MIT or>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Run a single benchmark once.  For use with profiling tools.


extern crate test;
extern crate html5ever;

use std::{fs, env};
use std::io::prelude::*;
use std::default::Default;

use test::black_box;

use html5ever::tokenizer::{TokenSink, Token, TokenizerOpts};
use html5ever::driver::{tokenize_to, one_input};

struct Sink;

impl TokenSink for Sink {
    fn process_token(&mut self, token: Token) {
        // Don't use the token, but make sure we don't get
        // optimized out entirely.

fn main() {
    let mut path = env::current_exe().unwrap();

    let mut file = fs::File::open(&path).unwrap();
    let mut file_input = String::new();
    file.read_to_string(&mut file_input).unwrap();

    tokenize_to(Sink, one_input(file_input), TokenizerOpts {
        profile: true,
        .. Default::default()