--release
flag decrease binary size from 4.9M
to 1.9M
$ CRFLAGS=--release make bin
CRFLAGS
. For example:
$ CRFLAGS="--release --stats" make bin ✹
/usr/local/bin/crystal build --no-debug -o bin/ameba src/cli.cr --release --stats
Parse: 00:00:00.000123912 ( 0.19MB)
Semantic (top level): 00:00:00.220423575 ( 52.70MB)
Semantic (new): 00:00:00.002317802 ( 52.70MB)
Semantic (type declarations): 00:00:00.024875458 ( 52.70MB)
Semantic (abstract def check): 00:00:00.001466401 ( 52.70MB)
Semantic (ivars initializers): 00:00:00.162740006 ( 76.70MB)
Semantic (cvars initializers): 00:00:00.002485070 ( 76.70MB)
Semantic (main): 00:00:00.927657055 ( 189.13MB)
Semantic (cleanup): 00:00:00.002510379 ( 189.13MB)
Semantic (recursive struct check): 00:00:00.000961374 ( 189.13MB)
Codegen (crystal): 00:00:00.664403397 ( 229.13MB)
Codegen (bc+obj): 00:00:00.285879103 ( 229.13MB)
Codegen (linking): 00:00:00.179272187 ( 229.13MB)
Codegen (bc+obj):
- all previous .o files were reused
mkdir -p ../../bin
cp ./bin/ameba ../../bin
NOISE_ARRAY.each do |noise|
[sample_a, sample_b].each do |sample|
sample = sample.delete(noise)
end
end
This will make ameba say: [W] Lint/UselessAssign: Useless assignment to variable `sample`
> sample = sample.delete(noise)
^
sample
in the block is just a reference to the original value and assignment doesn't have any affect:sample_a = 1
sample_b = 2
[sample_a, sample_b].each do |sample|
sample = sample + 1
end
puts sample_a # => 1
puts sample_b # => 2
.editorconfig
file in the root of your project and there is trim_trailing_whitespace = true
option.
bin/ameba
, which can be executed.