Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rust:
- Performance counter stats for './target/release/fl':
- 4599,845765 task-clock (msec) # 0,999 CPUs utilized
- 113 context-switches # 0,025 K/sec
- 0 cpu-migrations # 0,000 K/sec
- 180 page-faults # 0,039 K/sec
- 9176424342 cycles # 1,995 GHz
- <not supported> stalled-cycles-frontend
- <not supported> stalled-cycles-backend
- 20897696040 instructions # 2,28 insns per cycle
- 4407729141 branches # 958,234 M/sec
- 96665839 branch-misses # 2,19% of all branches
- 4,602782304 seconds time elapsed
- Go:
- Performance counter stats for './main':
- 3171,965381 task-clock (msec) # 1,001 CPUs utilized
- 394 context-switches # 0,124 K/sec
- 18 cpu-migrations # 0,006 K/sec
- 1319 page-faults # 0,416 K/sec
- 6325636319 cycles # 1,994 GHz
- <not supported> stalled-cycles-frontend
- <not supported> stalled-cycles-backend
- 12869003798 instructions # 2,03 insns per cycle
- 2733416891 branches # 861,742 M/sec
- 42743835 branch-misses # 1,56% of all branches
- 3,168397273 seconds time elapsed
- Rust code:
- use std::io;
- use std::io::BufReader;
- use std::io::BufRead;
- use std::fs::File;
- fn main() {
- let f = File::open("www.js").unwrap();
- let mut file = BufReader::new(&f);
- let mut buffer = String::new();
- let mut count = 0;
- for line in file.lines() {
- let l = line.unwrap();
- if l.contains("array") {
- count += 1;
- }
- }
- println!("{}", count);
- }
- Go code:
- package main
- import (
- "bufio"
- "fmt"
- "log"
- "os"
- "runtime"
- "strings"
- )
- func main() {
- file, err := os.Open("www.js")
- if err != nil {
- log.Fatal(err)
- }
- count := 0
- scanner := bufio.NewScanner(file)
- for scanner.Scan() {
- if strings.Contains(scanner.Text(), "array") {
- count++
- }
- }
- fmt.Println(count)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement