This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Euler.Math.Prime do | |
def primes_up_to_slow(up_to) do | |
wheel2357 | |
|> Stream.take_while( &( &1 <= up_to ) ) | |
|> Enum.reduce( | |
[], | |
fn(x, primes) -> | |
limit=Float.ceil(:math.sqrt(x)) | |
if(Euler.Math.Prime.test_prime_fast?(x, limit, Enum.reverse(primes))) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule BasicBench do | |
use Benchfella | |
@string_short 1..10 |> Enum.reduce( "", fn(_, acc) -> "a" <> acc end ) | |
@string_100 1..100 |> Enum.reduce( "", fn(_, acc) -> "a" <> acc end ) | |
@string_1000 1..1_000 |> Enum.reduce( "", fn(_, acc) -> "a" <> acc end ) | |
@string_10k 1..10_000 |> Enum.reduce( "", fn(_, acc) -> "a" <> acc end ) | |
@string_100k 1..10 |> Enum.reduce( "", fn(x, acc) -> @string_10k <> acc end ) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# column :record_type, 2, :type => :integer | |
# column :sender, 5 | |
# column :recipient, 5 | |
# column :sequence, 5, :type => :integer | |
# column :tax_treatment, 1 | |
# column :tax_rate, 32, :type => :integer | |
# spacer 13 | |
# column :file_creation_date, 6, :type => :date, :format => '%y%m%d' | |
# column :file_transmission_date, 6, :type => :date, :format => '%y%m%d' | |
# column :cutoff_time, 12, :type => :string, :format => '%y%m%d%H%M%S' |