Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Performance counter stats for './target/release/fl':
- 3570,953007 task-clock (msec) # 1,000 CPUs utilized
- 10 context-switches # 0,003 K/sec
- 0 cpu-migrations # 0,000 K/sec
- 113 page-faults # 0,032 K/sec
- 7122554792 cycles # 1,995 GHz
- <not supported> stalled-cycles-frontend
- <not supported> stalled-cycles-backend
- 14789974128 instructions # 2,08 insns per cycle
- 3270834989 branches # 915,956 M/sec
- 98659373 branch-misses # 3,02% of all branches
- 3,571524133 seconds time elapsed
- Performance counter stats for './main':
- 2666,074874 task-clock (msec) # 1,001 CPUs utilized
- 342 context-switches # 0,128 K/sec
- 8 cpu-migrations # 0,003 K/sec
- 137 page-faults # 0,051 K/sec
- 5311949003 cycles # 1,992 GHz
- <not supported> stalled-cycles-frontend
- <not supported> stalled-cycles-backend
- 10034346466 instructions # 1,89 insns per cycle
- 2073760220 branches # 777,833 M/sec
- 52485608 branch-misses # 2,53% of all branches
- 2,663269590 seconds time elapsed
- 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;
- while file.read_line(&mut buffer).unwrap() != 0 {
- if buffer.contains("array") {
- count += 1;
- }
- buffer.clear();
- }
- println!("{}", count);
- }
- package main
- import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "log"
- "os"
- )
- func main() {
- f, err := os.Open("www.js")
- count := 0
- bf := bufio.NewReader(f)
- arr := []byte("array")
- for {
- line, _, err := bf.ReadLine()
- if err == io.EOF {
- break
- }
- if bytes.Contains(line, arr) {
- count++
- }
- }
- fmt.Println(count)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement