Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String.prototype.replace() #217

Merged
merged 7 commits into from
Jan 20, 2020
Merged

String.prototype.replace() #217

merged 7 commits into from
Jan 20, 2020

Conversation

jasonwilliams
Copy link
Member

No description provided.

@github-actions
Copy link

Benchmark for 9502716

Click to view benchmark
Test PR Benchmark Master Benchmark %
Create Realm 425.4±16.91µs 414.0±9.95µs 103%
Hello World (Execution) 437.2±8.13µs 431.0±8.91µs 101%
Hello World (Lexer) 1044.8±23.24ns 1020.4±22.97ns 102%
Hello World (Parser) 1064.5±29.59ns 1198.0±75.38ns 87.00000000000001%
Symbol Creation 503.5±9.15µs 495.9±15.85µs 102%
fibonacci (Execution) 5.2±0.08ms 5.3±0.08ms 99%
undefined undefined 100%

@github-actions
Copy link

Benchmark for 1f35b0a

Click to view benchmark
Test PR Benchmark Master Benchmark %
Create Realm 449.4±16.07µs 435.6±16.37µs 103%
Hello World (Execution) 469.4±17.33µs 446.7±19.56µs 105%
Hello World (Lexer) 1099.1±35.16ns 1100.5±56.42ns 100%
Hello World (Parser) 1102.8±34.53ns 1059.1±43.01ns 104%
Symbol Creation 537.2±20.73µs 513.8±32.46µs 105%
fibonacci (Execution) 5.5±0.12ms 5.2±0.19ms 106%
undefined undefined 100%

@github-actions
Copy link

Benchmark for ac706b4

Click to view benchmark
Test PR Benchmark Master Benchmark %
Create Realm 431.5±18.69µs 415.1±20.66µs 104%
Hello World (Execution) 433.4±21.65µs 430.7±21.79µs 101%
Hello World (Lexer) 957.4±44.74ns 1204.5±80.13ns 74%
Hello World (Parser) 1218.8±71.37ns 1161.2±62.66ns 105%
Symbol Creation 514.5±30.57µs 495.8±30.53µs 104%
fibonacci (Execution) 5.1±0.21ms 5.0±0.17ms 102%
undefined undefined 100%

@github-actions
Copy link

Benchmark for dd1a5ba

Click to view benchmark
Test PR Benchmark Master Benchmark %
Create Realm 466.7±16.25µs 461.2±14.42µs 101%
Expression (Parser) 10.9±0.46µs 10.9±0.61µs 100%
Hello World (Execution) 485.4±19.69µs 494.0±26.37µs 98%
Hello World (Lexer) 1159.7±42.42ns 1154.3±90.08ns 100%
Hello World (Parser) 1177.4±57.27ns 1226.3±68.76ns 96%
Symbol Creation 552.8±23.73µs 547.5±16.35µs 101%
fibonacci (Execution) 5.6±0.18ms 5.8±0.36ms 97%
undefined undefined 100%

@jasonwilliams jasonwilliams changed the title String Replace addition String Replace Jan 19, 2020
@jasonwilliams jasonwilliams changed the title String Replace String.prototype.replace() Jan 19, 2020
@@ -322,6 +324,117 @@ pub fn includes(this: &Value, args: &[Value], ctx: &mut Interpreter) -> ResultVa
Ok(to_value(this_string.contains(&search_string)))
}

/// Return either the string itself or the string of the regex equivalent
fn get_regex_string(value: &Value) -> String {
let mut regex_body = String::new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this, you can return directly from the match

@github-actions
Copy link

Benchmark for 73cf613

Click to view benchmark
Test PR Benchmark Master Benchmark %
Create Realm 385.7±18.73µs 376.7±27.26µs 102%
Expression (Parser) 9.5±0.70µs 9.2±0.44µs 103%
Hello World (Execution) 425.5±15.03µs 422.6±15.40µs 101%
Hello World (Lexer) 1078.9±61.37ns 959.0±76.59ns 112.99999999999999%
Hello World (Parser) 1031.7±56.36ns 996.1±52.48ns 104%
Symbol Creation 461.7±27.62µs 458.5±36.16µs 101%
fibonacci (Execution) 4.9±0.29ms 4.8±0.26ms 102%
undefined undefined 100%

@github-actions
Copy link

Benchmark for 9ab3495

Click to view benchmark
Test PR Benchmark Master Benchmark %
Create Realm 436.1±18.07µs 451.3±32.01µs 97%
Expression (Parser) 10.5±0.74µs 10.3±0.51µs 102%
Hello World (Execution) 454.3±32.86µs 452.6±19.02µs 100%
Hello World (Lexer) 1055.5±56.91ns 1133.1±55.92ns 93%
Hello World (Parser) 1118.0±64.79ns 1189.3±85.55ns 94%
Symbol Creation 519.7±27.05µs 522.2±31.20µs 100%
fibonacci (Execution) 5.4±0.22ms 5.4±0.22ms 99%
undefined undefined 100%

@github-actions
Copy link

Benchmark for b042f00

Click to view benchmark
Test PR Benchmark Master Benchmark %
Create Realm 483.6±16.02µs 456.7±22.39µs 106%
Expression (Parser) 10.5±0.41µs 10.4±0.52µs 100%
Hello World (Execution) 485.9±14.91µs 475.7±24.64µs 102%
Hello World (Lexer) 1060.7±41.98ns 1084.4±48.27ns 98%
Hello World (Parser) 1150.1±52.93ns 1195.6±44.08ns 96%
Symbol Creation 556.2±22.40µs 551.1±23.83µs 101%
fibonacci (Execution) 5.5±0.17ms 5.5±0.14ms 101%
undefined undefined 100%

@jasonwilliams jasonwilliams merged commit 495f0a4 into master Jan 20, 2020
@jasonwilliams jasonwilliams deleted the string-replace-2 branch April 3, 2020 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants