Skip to content

Commit

Permalink
Revert "Setup .gitattributes for eol normalization"
Browse files Browse the repository at this point in the history
This commit is overly eager on fixing the existing files' EOLs.
I also have reservations about enforcing EOL rules, and would like to
discuss it a little further.

This reverts commit b111911.
  • Loading branch information
BanzaiMan committed Dec 7, 2012
1 parent 37fe6d2 commit 1c39df7
Show file tree
Hide file tree
Showing 59 changed files with 4,434 additions and 4,448 deletions.
14 changes: 0 additions & 14 deletions .gitattributes

This file was deleted.

42 changes: 21 additions & 21 deletions bench/shootout/nsieve.ruby-2.ruby
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# The Computer Language Shootout
# http://shootout.alioth.debian.org/
# contributed by Pavel Valodzka

def nsieve(m)
is_prime = Array.new(m, true)
count = 0
2.upto(m){|i|
if is_prime[i]
(2 * i).step(m, i){|v|
is_prime[v] = false
}
count += 1
end
}
return count
end

n = (ARGV[0] || 2).to_i
n = 2 if (n < 2)

3.times {|t|
m = (1<<n-t)*10000
printf("Primes up to %8d%9d\n", m, nsieve(m))

def nsieve(m)
is_prime = Array.new(m, true)
count = 0
2.upto(m){|i|
if is_prime[i]
(2 * i).step(m, i){|v|
is_prime[v] = false
}
count += 1
end
}
return count
end

n = (ARGV[0] || 2).to_i
n = 2 if (n < 2)

3.times {|t|
m = (1<<n-t)*10000
printf("Primes up to %8d%9d\n", m, nsieve(m))
}
66 changes: 33 additions & 33 deletions bench/shootout/regexmatch.ruby
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
#!/usr/bin/ruby
# -*- mode: ruby -*-
# $Id: regexmatch.ruby,v 1.2 2005-05-17 05:20:31 bfulgham Exp $
# http://shootout.alioth.debian.org/
# modified by: Jon-Carlos Rivera

re = Regexp.new(
'(?:^|[^\d\(])' + # must be preceeded by non-digit
'(?:\((\d\d\d)\)|(\d\d\d))' + # match 1 or 2: area code is 3 digits
'[ ]' + # area code followed by one space
'(\d\d\d)' + # match 3: prefix of 3 digits
'[ -]' + # separator is either space or dash
'(\d\d\d\d)' + # match 4: last 4 digits
'\D' # must be followed by a non-digit
)

num = Integer(ARGV[0] || 1)

phones = STDIN.readlines

phonenum, count = "", 0

(1..num).each do |iter|
phones.each do |line|
if line =~ re
phonenum = "(#{($1 || $2)}) #{$3}-#{$4}";
if iter == num
count += 1
puts "#{count}: #{phonenum}"
end
end
end
end
#!/usr/bin/ruby
# -*- mode: ruby -*-
# $Id: regexmatch.ruby,v 1.2 2005-05-17 05:20:31 bfulgham Exp $
# http://shootout.alioth.debian.org/
# modified by: Jon-Carlos Rivera

re = Regexp.new(
'(?:^|[^\d\(])' + # must be preceeded by non-digit
'(?:\((\d\d\d)\)|(\d\d\d))' + # match 1 or 2: area code is 3 digits
'[ ]' + # area code followed by one space
'(\d\d\d)' + # match 3: prefix of 3 digits
'[ -]' + # separator is either space or dash
'(\d\d\d\d)' + # match 4: last 4 digits
'\D' # must be followed by a non-digit
)

num = Integer(ARGV[0] || 1)

phones = STDIN.readlines

phonenum, count = "", 0

(1..num).each do |iter|
phones.each do |line|
if line =~ re
phonenum = "(#{($1 || $2)}) #{$3}-#{$4}";
if iter == num
count += 1
puts "#{count}: #{phonenum}"
end
end
end
end
2 changes: 1 addition & 1 deletion bench/shootout/sumcol.ruby-2.ruby
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The Computer Language Benchmarks Game
# http://shootout.alioth.debian.org/
# contributed by Pavel Valodzka


puts STDIN.inject(0){|a,v| a + v.to_i }
52 changes: 26 additions & 26 deletions bench/yarv/bm_app_erb.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#
# Create many HTML strings with ERB.
#

require 'erb'

data = DATA.read
max = 5_000
title = "hello world!"
content = "hello world!\n" * 10

max.times{
ERB.new(data).result(binding)
}

__END__

<html>
<head> <%= title %> </head>
<body>
<h1> <%= title %> </h1>
<p>
<%= content %>
</p>
</body>
</html>
#
# Create many HTML strings with ERB.
#

require 'erb'

data = DATA.read
max = 5_000
title = "hello world!"
content = "hello world!\n" * 10

max.times{
ERB.new(data).result(binding)
}

__END__

<html>
<head> <%= title %> </head>
<body>
<h1> <%= title %> </h1>
<p>
<%= content %>
</p>
</body>
</html>
16 changes: 8 additions & 8 deletions bench/yarv/bm_app_uri.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'uri'

100_000.times{
uri = URI.parse('http://www.ruby-lang.org')
uri.scheme
uri.host
uri.port
}
require 'uri'

100_000.times{
uri = URI.parse('http://www.ruby-lang.org')
uri.scheme
uri.host
uri.port
}
26 changes: 13 additions & 13 deletions bench/yarv/bm_io_file_create.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#
# Create files
#

max = 50_000
file = './tmpfile_of_bm_io_file_create'

max.times{
f = open(file, 'w')
f.close#(true)
}
File.unlink(file)

#
# Create files
#

max = 50_000
file = './tmpfile_of_bm_io_file_create'

max.times{
f = open(file, 'w')
f.close#(true)
}
File.unlink(file)
30 changes: 15 additions & 15 deletions bench/yarv/bm_io_file_read.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#
# Seek and Read file.
#

require 'tempfile'

max = 20_000
str = "Hello world! " * 1000
f = Tempfile.new('yarv-benchmark')
f.write str

max.times{
f.seek 0
f.read
}
#
# Seek and Read file.
#

require 'tempfile'

max = 20_000
str = "Hello world! " * 1000
f = Tempfile.new('yarv-benchmark')
f.write str

max.times{
f.seek 0
f.read
}
28 changes: 14 additions & 14 deletions bench/yarv/bm_io_file_write.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#
# Seek and Write file.
#

require 'tempfile'

max = 20_000
str = "Hello world! " * 1000
f = Tempfile.new('yarv-benchmark')

max.times{
f.seek 0
f.write str
}
#
# Seek and Write file.
#

require 'tempfile'

max = 20_000
str = "Hello world! " * 1000
f = Tempfile.new('yarv-benchmark')

max.times{
f.seek 0
f.write str
}
Loading

0 comments on commit 1c39df7

Please sign in to comment.