Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. rust:
  2. Performance counter stats for './target/release/fl':
  3.  
  4. 4599,845765 task-clock (msec) # 0,999 CPUs utilized
  5. 113 context-switches # 0,025 K/sec
  6. 0 cpu-migrations # 0,000 K/sec
  7. 180 page-faults # 0,039 K/sec
  8. 9176424342 cycles # 1,995 GHz
  9. <not supported> stalled-cycles-frontend
  10. <not supported> stalled-cycles-backend
  11. 20897696040 instructions # 2,28 insns per cycle
  12. 4407729141 branches # 958,234 M/sec
  13. 96665839 branch-misses # 2,19% of all branches
  14.  
  15. 4,602782304 seconds time elapsed
  16.  
  17.  
  18. Go:
  19.  
  20. Performance counter stats for './main':
  21.  
  22. 3171,965381 task-clock (msec) # 1,001 CPUs utilized
  23. 394 context-switches # 0,124 K/sec
  24. 18 cpu-migrations # 0,006 K/sec
  25. 1319 page-faults # 0,416 K/sec
  26. 6325636319 cycles # 1,994 GHz
  27. <not supported> stalled-cycles-frontend
  28. <not supported> stalled-cycles-backend
  29. 12869003798 instructions # 2,03 insns per cycle
  30. 2733416891 branches # 861,742 M/sec
  31. 42743835 branch-misses # 1,56% of all branches
  32.  
  33. 3,168397273 seconds time elapsed
  34.  
  35.  
  36. Rust code:
  37.  
  38. use std::io;
  39. use std::io::BufReader;
  40. use std::io::BufRead;
  41. use std::fs::File;
  42.  
  43. fn main() {
  44. let f = File::open("www.js").unwrap();
  45. let mut file = BufReader::new(&f);
  46. let mut buffer = String::new();
  47. let mut count = 0;
  48.  
  49. for line in file.lines() {
  50. let l = line.unwrap();
  51. if l.contains("array") {
  52. count += 1;
  53. }
  54. }
  55.  
  56.  
  57. println!("{}", count);
  58. }
  59.  
  60.  
  61. Go code:
  62.  
  63. package main
  64.  
  65. import (
  66. "bufio"
  67. "fmt"
  68. "log"
  69. "os"
  70. "runtime"
  71. "strings"
  72. )
  73.  
  74. func main() {
  75.  
  76. file, err := os.Open("www.js")
  77. if err != nil {
  78. log.Fatal(err)
  79. }
  80. count := 0
  81. scanner := bufio.NewScanner(file)
  82. for scanner.Scan() {
  83. if strings.Contains(scanner.Text(), "array") {
  84. count++
  85. }
  86. }
  87.  
  88. fmt.Println(count)
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement