Skip to content

Commit

Permalink
Next (rusty-ecma#22)
Browse files Browse the repository at this point in the history
* possible performance improvements?

* clippy + spelling

* added zero-copy parsers and related constucts.
Made some stuff public to allow for benchmarking how worth it is it

* fix keyword issues

* cargo fmt

* remove unused parsers

* trim_left_matches > trim_start_matches

* ref_scanner now available

* add refs flag to major_libs example

* unneeded

* cargo fmt

* reconcile changes on master

* RefScanner bug fixes

* update travis to include moz_central test

* bump version

* remove auto enabing logging
  • Loading branch information
FreeMasen committed Feb 4, 2019
1 parent 01c1862 commit d873fc1
Show file tree
Hide file tree
Showing 29 changed files with 3,674 additions and 226 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ Cargo.lock
*.log
*.js
package-lock.json
moz-central
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -12,7 +12,7 @@ matrix:
before_cache:
- rm -rf /home/travis/.cargo/registry
script:
- cargo test
- cargo test --features moz_central
- cargo run --example major_libs --release
after_script:
- git add proptest-regressions
Expand Down
14 changes: 11 additions & 3 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ress"
version = "0.6.2"
version = "0.6.3"
authors = ["Robert Masen <r@robertmasen.pizza>"]
description = "A sanner/tokenizer for JS files"
keywords = ["JavaScript", "parsing", "JS", "ES", "ECMA"]
Expand All @@ -14,10 +14,12 @@ travis-ci = { repository = "FreeMasen/RESS", branch = "master" }
appveyor = { repository = "FreeMasen/RESS", branch = "master", service = "github" }

[dependencies]
combine = "3.3"
combine = "3"
log = "0.4"
unic-ucd-ident = { version = "0.7", features = ["id"] }

flate2 = { version = "1", optional = true }
reqwest = { version = "0.9", optional = true }
tar = { version = "0.4", optional = true}

[dev-dependencies]
docopt = "1.0"
Expand All @@ -26,6 +28,12 @@ serde_derive = "1.0"
proptest = "0.8"
walkdir = "2.2"
pretty_env_logger = "0.2"
regex_generate = "0.2.0"
lazy_static = "1"

[features]
default = []
moz_central = ["flate2", "reqwest", "tar"]

[[example]]
name = "major_libs"
Expand Down
13 changes: 13 additions & 0 deletions bench.md
@@ -0,0 +1,13 @@
| output | refs bench | refs +/- | orig bench | orig +/- |
| --------- | ---------- | -------- | ---------- | -------- |
| bools | 196 | 12 | 498 | 28 |
| comments | 5,830 | 1260 | 8,658 | 198 |
| idents | 32,232 | 947 | 37,967 | 1680 |
| keywords | 23,050 | 6,436 | 20,375 | 197 |
| null | 83 | 5 | 97 | 3 |
| numbers | 11,521 | 2,872 | 21,999 | 621 |
| punct | 24,985 | 497 | 34,006 | 1,918 |
| regex | 26,558 | 642 | 71,059 | 2,093 |
| strings | 23,251 | 4,121 | 50,262 | 1,363 |
| templates | 34,015 | 544 | 68,190 | 921 |
| token | 293,377 | 9,556 | 343,875 | 9,141 |
14 changes: 14 additions & 0 deletions benches/major_libs.rs
@@ -0,0 +1,14 @@
#![cfg(test)]
#![feature(test)]
extern crate ress;
extern crate test;
use ress::Scanner;
use test::Bencher;
#[bench]
fn angular(b: &mut Bencher) {
let js = include_str!("../node_modules/angular/angular.js");
b.iter(|| {
let s = Scanner::new(js);
let _: Vec<ress::Item> = s.collect();
})
}
15 changes: 15 additions & 0 deletions benches/numbers.rs
@@ -0,0 +1,15 @@
#![cfg(test)]
#![feature(test)]
extern crate combine;
extern crate ress;
extern crate test;

use combine::Parser;
use ress::numeric::literal as number;
use test::Bencher;
#[bench]
fn number_non_decimal(b: &mut Bencher) {
b.iter(|| {
number().parse("0x5541ff6").unwrap();
});
}

0 comments on commit d873fc1

Please sign in to comment.