This file contains hidden or 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
# This Crystal source file is a multiple threaded implementation to perform an | |
# extremely fast Segmented Sieve of Zakiya (SSoZ) to find Twin Primes <= N. | |
# Inputs are single values N, or ranges N1 and N2, of 64-bits, 0 -- 2^64 - 1. | |
# Output is the number of twin primes <= N, or in range N1 to N2; the last | |
# twin prime value for the range; and the total time of execution. | |
# This code was developed on a System76 laptop with an Intel I7 6700HQ cpu, | |
# 2.6-3.5 GHz clock, with 8 threads, and 16GB of memory. Parameter tuning | |
# probably needed to optimize for other hardware systems (ARM, PowerPC, etc). |
This file contains hidden or 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
# One can write a class that wraps a Proc and calls it: | |
class Handler | |
def initialize(&@proc : -> String) | |
end | |
def call | |
@proc.call | |
end | |
end |
This file contains hidden or 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
require "benchmark" | |
struct Foo | |
def initialize(@size : Int32, @stride : Int32) | |
end | |
def step_from_class | |
0.step(to: @size, by: @stride) do |i| | |
yield i | |
end |
This file contains hidden or 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
require "benchmark" | |
struct Foo | |
def initialize(@size : Int32, @stride : Int32) | |
end | |
def step_from_class | |
0.step(to: @size, by: @stride) do |i| | |
yield i | |
end |
This file contains hidden or 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
def reset | |
user = current_user | |
return unless user | |
user_id = user.id | |
return unless user_id | |
server = VirtualMachine.find_by(user_id: user_id, id: params[:server_id]) | |
return unless server |
This file contains hidden or 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
require "spec" | |
require "json" | |
require "yaml" | |
class JSON::Builder | |
def next_is_object_key? | |
state = @state.last | |
state.is_a?(ObjectState) && state.name | |
end | |
end |
This file contains hidden or 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
9 - [Bool, Int32, Int64, Slice(UInt8), String, UInt16, UInt32, UInt64, UInt8] | |
2 - [Crystal::Formatter::HeredocInfo, Crystal::StringInterpolation] | |
5 - [JSON::Builder::ArrayState, JSON::Builder::DocumentEndState, JSON::Builder::DocumentStartState, JSON::Builder::ObjectState, JSON::Builder::StartState] | |
3 - [Bool, Crystal::Compiler::Result, Nil] | |
2 - [Tuple(Int32), Tuple(Int32, Int32)] | |
2 - [Tuple(Char), Tuple(Char, Char)] | |
2 - [Pointer(Pointer(Void)), Pointer(Void)] | |
2 - [Bool, Slice(UInt8)] | |
3 - [Colorize::Color256, Colorize::ColorANSI, Colorize::ColorRGB] | |
2 - [HTTP::Headers::Key, String] |
This file contains hidden or 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
+13 | |
+19 | |
+11 | |
+15 | |
+1 | |
+7 | |
+17 | |
+14 | |
-16 | |
+15 |
This file contains hidden or 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
diff --git a/src/compiler/crystal/semantic/cleanup_transformer.cr b/src/compiler/crystal/semantic/cleanup_transformer.cr | |
index e108c12f1..59a21ef07 100644 | |
--- a/src/compiler/crystal/semantic/cleanup_transformer.cr | |
+++ b/src/compiler/crystal/semantic/cleanup_transformer.cr | |
@@ -23,6 +23,8 @@ module Crystal | |
initializer.node = initializer.node.transform(transformer) | |
end | |
end | |
+ | |
+ TypesAndMethodsPrinter.new.print_types_and_methods(self) |
This file contains hidden or 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
require "spec" | |
require "json" | |
require "uuid" | |
require "uuid/json" | |
require "big/json" | |
module JSON | |
annotation Field | |
end |