bench9000 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +7 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-bilinear.rb +69 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-nearest-neighbor.rb +68 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-steps-residues.rb +37 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-steps.rb +37 -0
- data/benchmarks/chunky_png/chunky-color-a.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-b.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-compose-quick.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-g.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-r.rb +39 -0
- data/benchmarks/chunky_png/chunky-decode-png-image-pass.rb +74 -0
- data/benchmarks/chunky_png/chunky-encode-png-image-pass-to-stream.rb +84 -0
- data/benchmarks/chunky_png/chunky-operations-compose.rb +70 -0
- data/benchmarks/chunky_png/chunky-operations-replace.rb +69 -0
- data/benchmarks/chunky_png/chunky_png.patch +22 -0
- data/benchmarks/chunky_png/version.txt +2 -0
- data/benchmarks/classic/binary-trees.rb +100 -0
- data/benchmarks/classic/deltablue.rb +732 -0
- data/benchmarks/classic/fannkuch-redux.rb +111 -0
- data/benchmarks/classic/fasta-string.rb +71 -0
- data/benchmarks/classic/mandelbrot.rb +112 -0
- data/benchmarks/classic/matrix-multiply.rb +78 -0
- data/benchmarks/classic/n-body.rb +188 -0
- data/benchmarks/classic/pidigits.rb +88 -0
- data/benchmarks/classic/red-black.rb +363 -0
- data/benchmarks/classic/richards-kwargs.rb +403 -0
- data/benchmarks/classic/richards.rb +403 -0
- data/benchmarks/classic/spectral-norm.rb +95 -0
- data/benchmarks/default.config.rb +206 -0
- data/benchmarks/graph/connected.rb +62 -0
- data/benchmarks/literature/acid.rb +46 -0
- data/benchmarks/micro/pack-big-U-loop.rb +24 -0
- data/benchmarks/micro/pack-big-xLX-repeat.rb +22 -0
- data/benchmarks/micro/pack-small-mixture.rb +17 -0
- data/benchmarks/micro/string-equal.rb +28 -0
- data/benchmarks/octane/deltablue.rb +981 -0
- data/benchmarks/psd.rb/mock-logger.rb +23 -0
- data/benchmarks/psd.rb/psd-color-cmyk-to-rgb.rb +46 -0
- data/benchmarks/psd.rb/psd-compose-color-burn.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-color-dodge.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-darken.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-difference.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-exclusion.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-hard-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-hard-mix.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-lighten.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-linear-burn.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-linear-dodge.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-linear-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-multiply.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-normal.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-overlay.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-pin-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-screen.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-soft-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-vivid-light.rb +43 -0
- data/benchmarks/psd.rb/psd-imageformat-layerraw-parse-raw.rb +70 -0
- data/benchmarks/psd.rb/psd-imageformat-rle-decode-rle-channel.rb +87 -0
- data/benchmarks/psd.rb/psd-imagemode-cmyk-combine-cmyk-channel.rb +65 -0
- data/benchmarks/psd.rb/psd-imagemode-greyscale-combine-greyscale-channel.rb +68 -0
- data/benchmarks/psd.rb/psd-imagemode-rgb-combine-rgb-channel.rb +65 -0
- data/benchmarks/psd.rb/psd-renderer-blender-compose.rb +113 -0
- data/benchmarks/psd.rb/psd-renderer-clippingmask-apply.rb +129 -0
- data/benchmarks/psd.rb/psd-renderer-mask-apply.rb +137 -0
- data/benchmarks/psd.rb/psd-util-clamp.rb +42 -0
- data/benchmarks/psd.rb/psd-util-pad2.rb +42 -0
- data/benchmarks/psd.rb/psd-util-pad4.rb +42 -0
- data/benchmarks/psd.rb/psd_native.patch +99 -0
- data/benchmarks/psd.rb/version.txt +2 -0
- data/benchmarks/topaz/neural-net.rb +208 -0
- data/benchmarks/vm/codeload.rb +35 -0
- data/benchmarks/vm/fixtures/codeload/LICENSE.txt +25 -0
- data/benchmarks/vm/fixtures/codeload/lexer.rb +21493 -0
- data/bin/bench9000 +13 -0
- data/example/report.data +945 -0
- data/example/report.html +59178 -0
- data/lib/bench9000.rb +27 -0
- data/lib/bench9000/benchmark.rb +29 -0
- data/lib/bench9000/commands/command.rb +30 -0
- data/lib/bench9000/commands/compare-reference.rb +70 -0
- data/lib/bench9000/commands/compare.rb +43 -0
- data/lib/bench9000/commands/detail.rb +51 -0
- data/lib/bench9000/commands/list-benchmarks.rb +29 -0
- data/lib/bench9000/commands/list-implementations.rb +29 -0
- data/lib/bench9000/commands/reference.rb +46 -0
- data/lib/bench9000/commands/remove.rb +41 -0
- data/lib/bench9000/commands/report.rb +71 -0
- data/lib/bench9000/commands/score.rb +27 -0
- data/lib/bench9000/config.rb +88 -0
- data/lib/bench9000/group.rb +23 -0
- data/lib/bench9000/harness.rb +68 -0
- data/lib/bench9000/implementation.rb +134 -0
- data/lib/bench9000/json-formatter.rb +50 -0
- data/lib/bench9000/main.rb +268 -0
- data/lib/bench9000/measurement.rb +75 -0
- data/lib/bench9000/micro-harness.rb +39 -0
- data/lib/bench9000/options.rb +31 -0
- data/lib/bench9000/report/bootstrap-theme.css +5 -0
- data/lib/bench9000/report/bootstrap.css +5 -0
- data/lib/bench9000/report/bootstrap.js +6 -0
- data/lib/bench9000/report/chart.js +3432 -0
- data/lib/bench9000/report/chartjs.patch +91 -0
- data/lib/bench9000/report/jquery.js +4 -0
- data/lib/bench9000/report/report.html +177 -0
- data/lib/bench9000/report/report.js +547 -0
- data/lib/bench9000/stats.rb +41 -0
- data/readme.md +205 -0
- data/vendor/chunky_png/BENCHMARKS.rdoc +31 -0
- data/vendor/chunky_png/Gemfile +10 -0
- data/vendor/chunky_png/LICENSE +20 -0
- data/vendor/chunky_png/README.rdoc +84 -0
- data/vendor/chunky_png/Rakefile +11 -0
- data/vendor/chunky_png/benchmarks/decoding_benchmark.rb +36 -0
- data/vendor/chunky_png/benchmarks/encoding_benchmark.rb +40 -0
- data/vendor/chunky_png/benchmarks/filesize_benchmark.rb +28 -0
- data/vendor/chunky_png/chunky_png.gemspec +47 -0
- data/vendor/chunky_png/lib/chunky_png.rb +160 -0
- data/vendor/chunky_png/lib/chunky_png/canvas.rb +372 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/adam7_interlacing.rb +72 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/data_url_exporting.rb +15 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/data_url_importing.rb +21 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/drawing.rb +338 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/masking.rb +91 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/operations.rb +395 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/png_decoding.rb +492 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/png_encoding.rb +442 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/resampling.rb +147 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/stream_exporting.rb +58 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/stream_importing.rb +77 -0
- data/vendor/chunky_png/lib/chunky_png/chunk.rb +328 -0
- data/vendor/chunky_png/lib/chunky_png/color.rb +780 -0
- data/vendor/chunky_png/lib/chunky_png/compatibility.rb +15 -0
- data/vendor/chunky_png/lib/chunky_png/datastream.rb +185 -0
- data/vendor/chunky_png/lib/chunky_png/dimension.rb +113 -0
- data/vendor/chunky_png/lib/chunky_png/image.rb +79 -0
- data/vendor/chunky_png/lib/chunky_png/palette.rb +209 -0
- data/vendor/chunky_png/lib/chunky_png/point.rb +115 -0
- data/vendor/chunky_png/lib/chunky_png/rmagick.rb +43 -0
- data/vendor/chunky_png/lib/chunky_png/vector.rb +186 -0
- data/vendor/chunky_png/lib/chunky_png/version.rb +5 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/adam7_interlacing_spec.rb +106 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/data_url_exporting_spec.rb +13 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/data_url_importing_spec.rb +15 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/drawing_spec.rb +170 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/masking_spec.rb +51 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/operations_spec.rb +388 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/png_decoding_spec.rb +97 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/png_encoding_spec.rb +235 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/resampling_spec.rb +121 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/stream_exporting_spec.rb +59 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/stream_importing_spec.rb +31 -0
- data/vendor/chunky_png/spec/chunky_png/canvas_spec.rb +226 -0
- data/vendor/chunky_png/spec/chunky_png/color_spec.rb +251 -0
- data/vendor/chunky_png/spec/chunky_png/datastream_spec.rb +32 -0
- data/vendor/chunky_png/spec/chunky_png/dimension_spec.rb +48 -0
- data/vendor/chunky_png/spec/chunky_png/image_spec.rb +25 -0
- data/vendor/chunky_png/spec/chunky_png/point_spec.rb +76 -0
- data/vendor/chunky_png/spec/chunky_png/rmagick_spec.rb +23 -0
- data/vendor/chunky_png/spec/chunky_png/vector_spec.rb +104 -0
- data/vendor/chunky_png/spec/chunky_png_spec.rb +8 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgai4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgai4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgan6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgan6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgbn4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bggn4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgwn6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgyn6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g01.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p01.rgba +1 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g01.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p01.rgba +1 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/broken/x00n0g01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/broken/xcrn0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/broken/xlfn0g04.png +13 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi1n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi1n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi2n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi2n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi4n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi4n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi9n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi9n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z00n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z03n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z06n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z09n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g03n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g03n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g03n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g04n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g04n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g04n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g05n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g05n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g05n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g07n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g07n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g07n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g10n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g10n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g10n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g25n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g25n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g25n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/metadata/cm0n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/metadata/cm7n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/metadata/cm9n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ccwn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ccwn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdfn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdhn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdsn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdun2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ch1n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ch2n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs3n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs3n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs5n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs5n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs8n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs8n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ct0n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ct1n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ctzn0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/pp0n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/pp0n6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps1n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps1n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps2n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps2n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s01i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s01n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s02i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s02n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s03i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s03n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s04i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s04n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s05i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s05n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s06i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s06n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s07i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s07n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s08i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s08n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s09i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s09n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s32i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s32n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s33i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s33n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s34i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s34n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s35i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s35n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s36i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s36n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s37i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s37n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s38i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s38n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s39i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s39n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s40i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s40n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbbn1g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbbn2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbbn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbgn2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbgn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbrn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbwn1g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbwn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbyn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp0n1g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp0n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp0n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp1n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite_spec.rb +121 -0
- data/vendor/chunky_png/spec/resources/adam7.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_five_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_four_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_four_point_flipped.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_four_point_s.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_six_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_three_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_three_point_flipped.png +0 -0
- data/vendor/chunky_png/spec/resources/circles.png +0 -0
- data/vendor/chunky_png/spec/resources/clock.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_base.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_bl_xdown_ydown.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_bl_xdown_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_bl_xup_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_mask.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_mask_updated.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_nn_xdown_ydown.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_nn_xdown_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_nn_xup_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_updated.png +0 -0
- data/vendor/chunky_png/spec/resources/composited.png +0 -0
- data/vendor/chunky_png/spec/resources/cropped.png +0 -0
- data/vendor/chunky_png/spec/resources/damaged_chunk.png +0 -0
- data/vendor/chunky_png/spec/resources/damaged_signature.png +13 -0
- data/vendor/chunky_png/spec/resources/lines.png +0 -0
- data/vendor/chunky_png/spec/resources/operations.png +0 -0
- data/vendor/chunky_png/spec/resources/operations_border.png +0 -0
- data/vendor/chunky_png/spec/resources/operations_grayscale.png +0 -0
- data/vendor/chunky_png/spec/resources/partial_circles.png +0 -0
- data/vendor/chunky_png/spec/resources/pixelstream.bgr +67 -0
- data/vendor/chunky_png/spec/resources/pixelstream.rgb +67 -1
- data/vendor/chunky_png/spec/resources/pixelstream.rgba +67 -0
- data/vendor/chunky_png/spec/resources/pixelstream_best_compression.png +0 -0
- data/vendor/chunky_png/spec/resources/pixelstream_fast_rgba.png +0 -0
- data/vendor/chunky_png/spec/resources/pixelstream_reference.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_filled_horizontal.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_filled_vertical.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_triangle_filled.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_unfilled.png +0 -0
- data/vendor/chunky_png/spec/resources/rect.png +0 -0
- data/vendor/chunky_png/spec/resources/replaced.png +0 -0
- data/vendor/chunky_png/spec/resources/text_chunk.png +0 -0
- data/vendor/chunky_png/spec/resources/ztxt_chunk.png +0 -0
- data/vendor/chunky_png/spec/spec_helper.rb +52 -0
- data/vendor/chunky_png/tasks/benchmarks.rake +26 -0
- data/vendor/oily_png/Gemfile +4 -0
- data/vendor/oily_png/LICENSE +20 -0
- data/vendor/oily_png/README.rdoc +26 -0
- data/vendor/oily_png/Rakefile +19 -0
- data/vendor/oily_png/ext/oily_png/color.c +58 -0
- data/vendor/oily_png/ext/oily_png/color.h +29 -0
- data/vendor/oily_png/ext/oily_png/extconf.rb +3 -0
- data/vendor/oily_png/ext/oily_png/oily_png_ext.c +59 -0
- data/vendor/oily_png/ext/oily_png/oily_png_ext.h +72 -0
- data/vendor/oily_png/ext/oily_png/operations.c +122 -0
- data/vendor/oily_png/ext/oily_png/operations.h +36 -0
- data/vendor/oily_png/ext/oily_png/png_decoding.c +374 -0
- data/vendor/oily_png/ext/oily_png/png_decoding.h +27 -0
- data/vendor/oily_png/ext/oily_png/png_encoding.c +302 -0
- data/vendor/oily_png/ext/oily_png/png_encoding.h +19 -0
- data/vendor/oily_png/ext/oily_png/resampling.c +213 -0
- data/vendor/oily_png/ext/oily_png/resampling.h +25 -0
- data/vendor/oily_png/lib/oily_png.rb +21 -0
- data/vendor/oily_png/lib/oily_png/canvas.rb +15 -0
- data/vendor/oily_png/lib/oily_png/version.rb +3 -0
- data/vendor/oily_png/oily_png.gemspec +39 -0
- data/vendor/oily_png/spec/color_spec.rb +38 -0
- data/vendor/oily_png/spec/decoding_spec.rb +51 -0
- data/vendor/oily_png/spec/encoding_spec.rb +135 -0
- data/vendor/oily_png/spec/operations_spec.rb +52 -0
- data/vendor/oily_png/spec/resampling_spec.rb +51 -0
- data/vendor/oily_png/spec/resources/basi0g01.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g02.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g04.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g08.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g16.png +0 -0
- data/vendor/oily_png/spec/resources/basi2c08.png +0 -0
- data/vendor/oily_png/spec/resources/basi2c16.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p01.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p02.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p04.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p08.png +0 -0
- data/vendor/oily_png/spec/resources/basi4a08.png +0 -0
- data/vendor/oily_png/spec/resources/basi4a16.png +0 -0
- data/vendor/oily_png/spec/resources/basi6a08.png +0 -0
- data/vendor/oily_png/spec/resources/basi6a16.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g01.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g02.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g04.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g08.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g16.png +0 -0
- data/vendor/oily_png/spec/resources/basn2c08.png +0 -0
- data/vendor/oily_png/spec/resources/basn2c16.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p01.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p02.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p04.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/basn4a08.png +0 -0
- data/vendor/oily_png/spec/resources/basn4a16.png +0 -0
- data/vendor/oily_png/spec/resources/basn6a08.png +0 -0
- data/vendor/oily_png/spec/resources/basn6a16.png +0 -0
- data/vendor/oily_png/spec/resources/composited.png +0 -0
- data/vendor/oily_png/spec/resources/gray.png +0 -0
- data/vendor/oily_png/spec/resources/interlaced.png +0 -0
- data/vendor/oily_png/spec/resources/nonsquare.png +0 -0
- data/vendor/oily_png/spec/resources/operations.png +0 -0
- data/vendor/oily_png/spec/resources/replaced.png +0 -0
- data/vendor/oily_png/spec/resources/s01i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s01n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s02i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s02n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s03i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s03n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s04i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s04n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s05i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s05n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s06i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s06n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s07i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s07n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s08i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s08n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s09i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s09n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s32i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s32n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s33i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s33n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s34i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s34n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s35i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s35n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s36i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s36n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s37i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s37n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s38i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s38n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s39i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s39n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s40i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s40n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/square.png +0 -0
- data/vendor/oily_png/spec/resources/tbbn1g04.png +0 -0
- data/vendor/oily_png/spec/resources/tbbn2c16.png +0 -0
- data/vendor/oily_png/spec/resources/tbbn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tbgn2c16.png +0 -0
- data/vendor/oily_png/spec/resources/tbgn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tbrn2c08.png +0 -0
- data/vendor/oily_png/spec/resources/tbwn1g16.png +0 -0
- data/vendor/oily_png/spec/resources/tbwn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tbyn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tp0n1g08.png +0 -0
- data/vendor/oily_png/spec/resources/tp0n2c08.png +0 -0
- data/vendor/oily_png/spec/resources/tp0n3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tp1n3p08.png +0 -0
- data/vendor/oily_png/spec/spec_helper.rb +40 -0
- data/vendor/oily_png/tasks/testing.rake +49 -0
- data/vendor/psd.rb/CONTRIBUTING.md +7 -0
- data/vendor/psd.rb/Gemfile +2 -0
- data/vendor/psd.rb/Guardfile +8 -0
- data/vendor/psd.rb/LICENSE.txt +22 -0
- data/vendor/psd.rb/README.md +235 -0
- data/vendor/psd.rb/Rakefile +6 -0
- data/vendor/psd.rb/circle.yml +6 -0
- data/vendor/psd.rb/examples/build_image.rb +16 -0
- data/vendor/psd.rb/examples/export_image.rb +12 -0
- data/vendor/psd.rb/examples/export_layer_images.rb +19 -0
- data/vendor/psd.rb/examples/export_node.rb +7 -0
- data/vendor/psd.rb/examples/export_text_data.rb +13 -0
- data/vendor/psd.rb/examples/guides.rb +17 -0
- data/vendor/psd.rb/examples/images/comp-example.psd +0 -0
- data/vendor/psd.rb/examples/images/example-cmyk.psd +0 -0
- data/vendor/psd.rb/examples/images/example-greyscale.psd +0 -0
- data/vendor/psd.rb/examples/images/example-nocompat.psd +0 -0
- data/vendor/psd.rb/examples/images/example.psd +0 -0
- data/vendor/psd.rb/examples/images/example16.psd +0 -0
- data/vendor/psd.rb/examples/images/guides.psd +0 -0
- data/vendor/psd.rb/examples/layer_comps.rb +20 -0
- data/vendor/psd.rb/examples/parse.rb +36 -0
- data/vendor/psd.rb/examples/path.rb +7 -0
- data/vendor/psd.rb/examples/profile.rb +15 -0
- data/vendor/psd.rb/examples/slices.rb +17 -0
- data/vendor/psd.rb/examples/tree.rb +8 -0
- data/vendor/psd.rb/examples/unimplemented_info.rb +9 -0
- data/vendor/psd.rb/lib/psd.rb +173 -0
- data/vendor/psd.rb/lib/psd/blend_mode.rb +80 -0
- data/vendor/psd.rb/lib/psd/channel_image.rb +115 -0
- data/vendor/psd.rb/lib/psd/color.rb +125 -0
- data/vendor/psd.rb/lib/psd/descriptor.rb +200 -0
- data/vendor/psd.rb/lib/psd/file.rb +104 -0
- data/vendor/psd.rb/lib/psd/header.rb +69 -0
- data/vendor/psd.rb/lib/psd/helpers.rb +51 -0
- data/vendor/psd.rb/lib/psd/image.rb +123 -0
- data/vendor/psd.rb/lib/psd/image_exports/png.rb +31 -0
- data/vendor/psd.rb/lib/psd/image_formats/layer_raw.rb +21 -0
- data/vendor/psd.rb/lib/psd/image_formats/layer_rle.rb +24 -0
- data/vendor/psd.rb/lib/psd/image_formats/raw.rb +12 -0
- data/vendor/psd.rb/lib/psd/image_formats/rle.rb +63 -0
- data/vendor/psd.rb/lib/psd/image_modes/cmyk.rb +31 -0
- data/vendor/psd.rb/lib/psd/image_modes/greyscale.rb +22 -0
- data/vendor/psd.rb/lib/psd/image_modes/rgb.rb +32 -0
- data/vendor/psd.rb/lib/psd/layer.rb +77 -0
- data/vendor/psd.rb/lib/psd/layer/blend_modes.rb +30 -0
- data/vendor/psd.rb/lib/psd/layer/blending_ranges.rb +62 -0
- data/vendor/psd.rb/lib/psd/layer/channel_image.rb +15 -0
- data/vendor/psd.rb/lib/psd/layer/exporting.rb +28 -0
- data/vendor/psd.rb/lib/psd/layer/helpers.rb +77 -0
- data/vendor/psd.rb/lib/psd/layer/info.rb +74 -0
- data/vendor/psd.rb/lib/psd/layer/mask.rb +19 -0
- data/vendor/psd.rb/lib/psd/layer/name.rb +33 -0
- data/vendor/psd.rb/lib/psd/layer/path_components.rb +22 -0
- data/vendor/psd.rb/lib/psd/layer/position_and_channels.rb +47 -0
- data/vendor/psd.rb/lib/psd/layer_info.rb +27 -0
- data/vendor/psd.rb/lib/psd/layer_info/blend_clipping_elements.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/blend_interior_elements.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/fill_opacity.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_group.rb +30 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_id.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_name_source.rb +14 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_section_divider.rb +48 -0
- data/vendor/psd.rb/lib/psd/layer_info/legacy_typetool.rb +88 -0
- data/vendor/psd.rb/lib/psd/layer_info/locked.rb +19 -0
- data/vendor/psd.rb/lib/psd/layer_info/metadata_setting.rb +35 -0
- data/vendor/psd.rb/lib/psd/layer_info/object_effects.rb +16 -0
- data/vendor/psd.rb/lib/psd/layer_info/placed_layer.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/reference_point.rb +16 -0
- data/vendor/psd.rb/lib/psd/layer_info/typetool.rb +165 -0
- data/vendor/psd.rb/lib/psd/layer_info/unicode_name.rb +17 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_mask.rb +25 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_mask_2.rb +10 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_stroke.rb +12 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_stroke_content.rb +15 -0
- data/vendor/psd.rb/lib/psd/layer_mask.rb +129 -0
- data/vendor/psd.rb/lib/psd/lazy_execute.rb +60 -0
- data/vendor/psd.rb/lib/psd/logger.rb +40 -0
- data/vendor/psd.rb/lib/psd/mask.rb +74 -0
- data/vendor/psd.rb/lib/psd/node.rb +70 -0
- data/vendor/psd.rb/lib/psd/node_exporting.rb +20 -0
- data/vendor/psd.rb/lib/psd/node_group.rb +86 -0
- data/vendor/psd.rb/lib/psd/node_layer.rb +81 -0
- data/vendor/psd.rb/lib/psd/node_root.rb +93 -0
- data/vendor/psd.rb/lib/psd/nodes/ancestry.rb +98 -0
- data/vendor/psd.rb/lib/psd/nodes/build_preview.rb +17 -0
- data/vendor/psd.rb/lib/psd/nodes/has_children.rb +13 -0
- data/vendor/psd.rb/lib/psd/nodes/lock_to_origin.rb +7 -0
- data/vendor/psd.rb/lib/psd/nodes/parse_layers.rb +18 -0
- data/vendor/psd.rb/lib/psd/nodes/search.rb +91 -0
- data/vendor/psd.rb/lib/psd/path_record.rb +180 -0
- data/vendor/psd.rb/lib/psd/renderer.rb +91 -0
- data/vendor/psd.rb/lib/psd/renderer/blender.rb +53 -0
- data/vendor/psd.rb/lib/psd/renderer/canvas.rb +95 -0
- data/vendor/psd.rb/lib/psd/renderer/canvas_management.rb +26 -0
- data/vendor/psd.rb/lib/psd/renderer/clipping_mask.rb +41 -0
- data/vendor/psd.rb/lib/psd/renderer/compose.rb +361 -0
- data/vendor/psd.rb/lib/psd/renderer/layer_styles.rb +56 -0
- data/vendor/psd.rb/lib/psd/renderer/layer_styles/color_overlay.rb +65 -0
- data/vendor/psd.rb/lib/psd/renderer/layer_styles/drop_shadow.rb +75 -0
- data/vendor/psd.rb/lib/psd/renderer/mask.rb +46 -0
- data/vendor/psd.rb/lib/psd/resource.rb +26 -0
- data/vendor/psd.rb/lib/psd/resource_section.rb +22 -0
- data/vendor/psd.rb/lib/psd/resources.rb +69 -0
- data/vendor/psd.rb/lib/psd/resources/guides.rb +35 -0
- data/vendor/psd.rb/lib/psd/resources/layer_comps.rb +42 -0
- data/vendor/psd.rb/lib/psd/resources/slices.rb +132 -0
- data/vendor/psd.rb/lib/psd/section.rb +26 -0
- data/vendor/psd.rb/lib/psd/util.rb +18 -0
- data/vendor/psd.rb/lib/psd/version.rb +3 -0
- data/vendor/psd.rb/psd.gemspec +32 -0
- data/vendor/psd.rb/spec/files/blendmodes.psd +0 -0
- data/vendor/psd.rb/spec/files/empty-layer-subgroups.psd +0 -0
- data/vendor/psd.rb/spec/files/empty-layer.psd +0 -0
- data/vendor/psd.rb/spec/files/example.psd +0 -0
- data/vendor/psd.rb/spec/files/guides.psd +0 -0
- data/vendor/psd.rb/spec/files/locked.psd +0 -0
- data/vendor/psd.rb/spec/files/one_layer.psd +0 -0
- data/vendor/psd.rb/spec/files/path.psd +0 -0
- data/vendor/psd.rb/spec/files/pixel.psd +0 -0
- data/vendor/psd.rb/spec/files/simplest.psd +0 -0
- data/vendor/psd.rb/spec/files/slices.psd +0 -0
- data/vendor/psd.rb/spec/files/text.psd +0 -0
- data/vendor/psd.rb/spec/guides_spec.rb +34 -0
- data/vendor/psd.rb/spec/hierarchy_spec.rb +152 -0
- data/vendor/psd.rb/spec/image_spec.rb +86 -0
- data/vendor/psd.rb/spec/lazy_execute_spec.rb +20 -0
- data/vendor/psd.rb/spec/locked_spec.rb +78 -0
- data/vendor/psd.rb/spec/parsing_spec.rb +163 -0
- data/vendor/psd.rb/spec/psd_spec.rb +37 -0
- data/vendor/psd.rb/spec/slices_spec.rb +57 -0
- data/vendor/psd.rb/spec/spec_helper.rb +13 -0
- data/vendor/psd.rb/spec/text_spec.rb +27 -0
- data/vendor/psd_native/Gemfile +4 -0
- data/vendor/psd_native/Guardfile +6 -0
- data/vendor/psd_native/LICENSE.txt +22 -0
- data/vendor/psd_native/README.md +48 -0
- data/vendor/psd_native/Rakefile +13 -0
- data/vendor/psd_native/ext/psd_native/blender.c +57 -0
- data/vendor/psd_native/ext/psd_native/blender.h +6 -0
- data/vendor/psd_native/ext/psd_native/canvas.c +9 -0
- data/vendor/psd_native/ext/psd_native/canvas.h +6 -0
- data/vendor/psd_native/ext/psd_native/clipping_mask.c +57 -0
- data/vendor/psd_native/ext/psd_native/clipping_mask.h +6 -0
- data/vendor/psd_native/ext/psd_native/color.c +20 -0
- data/vendor/psd_native/ext/psd_native/color.h +18 -0
- data/vendor/psd_native/ext/psd_native/compose.c +394 -0
- data/vendor/psd_native/ext/psd_native/compose.h +43 -0
- data/vendor/psd_native/ext/psd_native/extconf.rb +3 -0
- data/vendor/psd_native/ext/psd_native/file.c +20 -0
- data/vendor/psd_native/ext/psd_native/file.h +9 -0
- data/vendor/psd_native/ext/psd_native/image_mode_cmyk.c +64 -0
- data/vendor/psd_native/ext/psd_native/image_mode_cmyk.h +6 -0
- data/vendor/psd_native/ext/psd_native/image_mode_greyscale.c +27 -0
- data/vendor/psd_native/ext/psd_native/image_mode_greyscale.h +6 -0
- data/vendor/psd_native/ext/psd_native/image_mode_rgb.c +49 -0
- data/vendor/psd_native/ext/psd_native/image_mode_rgb.h +6 -0
- data/vendor/psd_native/ext/psd_native/layer_raw.c +20 -0
- data/vendor/psd_native/ext/psd_native/layer_raw.h +6 -0
- data/vendor/psd_native/ext/psd_native/mask.c +52 -0
- data/vendor/psd_native/ext/psd_native/mask.h +6 -0
- data/vendor/psd_native/ext/psd_native/psd_native_ext.c +87 -0
- data/vendor/psd_native/ext/psd_native/psd_native_ext.h +31 -0
- data/vendor/psd_native/ext/psd_native/rle_decoding.c +53 -0
- data/vendor/psd_native/ext/psd_native/rle_decoding.h +6 -0
- data/vendor/psd_native/ext/psd_native/util.c +17 -0
- data/vendor/psd_native/ext/psd_native/util.h +8 -0
- data/vendor/psd_native/lib/psd_native.rb +35 -0
- data/vendor/psd_native/lib/psd_native/compose.rb +19 -0
- data/vendor/psd_native/lib/psd_native/version.rb +3 -0
- data/vendor/psd_native/psd_native.gemspec +35 -0
- data/vendor/psd_native/spec/files/example.psd +0 -0
- data/vendor/psd_native/spec/files/one_layer.psd +0 -0
- data/vendor/psd_native/spec/files/path.psd +0 -0
- data/vendor/psd_native/spec/files/pixel.psd +0 -0
- data/vendor/psd_native/spec/files/simplest.psd +0 -0
- data/vendor/psd_native/spec/files/text.psd +0 -0
- data/vendor/psd_native/spec/image_spec.rb +86 -0
- data/vendor/psd_native/spec/psd_spec.rb +37 -0
- data/vendor/psd_native/spec/spec_helper.rb +13 -0
- data/vendor/psd_native/spec/util_spec.rb +15 -0
- metadata +767 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
# Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. This
|
2
|
+
# code is released under a tri EPL/GPL/LGPL license. You can use it,
|
3
|
+
# redistribute it and/or modify it under the terms of the:
|
4
|
+
#
|
5
|
+
# Eclipse Public License version 1.0
|
6
|
+
# GNU General Public License version 2
|
7
|
+
# GNU Lesser General Public License version 2.1
|
8
|
+
|
9
|
+
class Set
|
10
|
+
end
|
11
|
+
|
12
|
+
class SortedSet < Set
|
13
|
+
end
|
14
|
+
|
15
|
+
require "chunky_png"
|
16
|
+
|
17
|
+
Color = ChunkyPNG::Color
|
18
|
+
|
19
|
+
if ENV.include? 'BENCH_9000_NATIVE'
|
20
|
+
require "oily_png/oily_png"
|
21
|
+
end
|
22
|
+
|
23
|
+
WIDTH = 2000
|
24
|
+
HEIGHT = 2000
|
25
|
+
COLOR_MODE = ChunkyPNG::COLOR_TRUECOLOR_ALPHA
|
26
|
+
DEPTH = 8
|
27
|
+
PIXEL = 0x12345678
|
28
|
+
ENCODE_REPS = 100
|
29
|
+
|
30
|
+
PIXELS = [PIXEL] * WIDTH * HEIGHT
|
31
|
+
|
32
|
+
class MockCanvas
|
33
|
+
# I can't seem to lookup this constant correctly
|
34
|
+
#Color = ChunkyPNG::Color
|
35
|
+
|
36
|
+
if ENV.include? 'BENCH_9000_NATIVE'
|
37
|
+
include OilyPNG::PNGEncoding
|
38
|
+
else
|
39
|
+
include ChunkyPNG::Canvas::PNGEncoding
|
40
|
+
end
|
41
|
+
|
42
|
+
public :encode_png_image_pass_to_stream
|
43
|
+
|
44
|
+
def initialize
|
45
|
+
@pixels = PIXELS
|
46
|
+
end
|
47
|
+
|
48
|
+
def width
|
49
|
+
WIDTH
|
50
|
+
end
|
51
|
+
|
52
|
+
def height
|
53
|
+
HEIGHT
|
54
|
+
end
|
55
|
+
|
56
|
+
def pixels
|
57
|
+
@pixels
|
58
|
+
end
|
59
|
+
|
60
|
+
def row(y)
|
61
|
+
pixels.slice(y * width, width)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def harness_input
|
66
|
+
MockCanvas.new
|
67
|
+
end
|
68
|
+
|
69
|
+
def harness_sample(input)
|
70
|
+
stream = nil
|
71
|
+
|
72
|
+
ENCODE_REPS.times do
|
73
|
+
stream = ""
|
74
|
+
input.encode_png_image_pass_to_stream(stream, COLOR_MODE, DEPTH, 0) # TODO ChunkyPNG::FILTER_NONE)
|
75
|
+
end
|
76
|
+
|
77
|
+
stream
|
78
|
+
end
|
79
|
+
|
80
|
+
def harness_verify(output)
|
81
|
+
output.sum == 46080
|
82
|
+
end
|
83
|
+
|
84
|
+
require 'bench9000/harness'
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. This
|
2
|
+
# code is released under a tri EPL/GPL/LGPL license. You can use it,
|
3
|
+
# redistribute it and/or modify it under the terms of the:
|
4
|
+
#
|
5
|
+
# Eclipse Public License version 1.0
|
6
|
+
# GNU General Public License version 2
|
7
|
+
# GNU Lesser General Public License version 2.1
|
8
|
+
|
9
|
+
if ENV.include? 'BENCH_9000_NATIVE'
|
10
|
+
require "oily_png/oily_png"
|
11
|
+
else
|
12
|
+
require "chunky_png"
|
13
|
+
end
|
14
|
+
|
15
|
+
PIXEL = 0x12345678
|
16
|
+
INITIAL_VALUE = 2 ** 62 # Arbitrary long int value.
|
17
|
+
|
18
|
+
class MockCanvas
|
19
|
+
if ENV.include? 'BENCH_9000_NATIVE'
|
20
|
+
include OilyPNG::Operations
|
21
|
+
else
|
22
|
+
include ChunkyPNG::Canvas::Operations
|
23
|
+
end
|
24
|
+
|
25
|
+
public :compose!
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
@pixels = Array.new(width * height, INITIAL_VALUE)
|
29
|
+
|
30
|
+
@pixels.size.times do |n|
|
31
|
+
@pixels[n] = PIXEL
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def width
|
36
|
+
2000
|
37
|
+
end
|
38
|
+
|
39
|
+
def height
|
40
|
+
2000
|
41
|
+
end
|
42
|
+
|
43
|
+
def pixels
|
44
|
+
@pixels
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_pixel(x, y)
|
48
|
+
@pixels[y * width + x]
|
49
|
+
end
|
50
|
+
|
51
|
+
def set_pixel(x, y, color)
|
52
|
+
@pixels[y * width + x] = color
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def harness_input
|
57
|
+
[MockCanvas.new, MockCanvas.new]
|
58
|
+
end
|
59
|
+
|
60
|
+
def harness_sample(input)
|
61
|
+
onto, compose = input
|
62
|
+
onto.compose!(compose, 0, 0)
|
63
|
+
onto
|
64
|
+
end
|
65
|
+
|
66
|
+
def harness_verify(output)
|
67
|
+
output.pixels.inject(:+) == 882178784000000
|
68
|
+
end
|
69
|
+
|
70
|
+
require 'bench9000/harness'
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. This
|
2
|
+
# code is released under a tri EPL/GPL/LGPL license. You can use it,
|
3
|
+
# redistribute it and/or modify it under the terms of the:
|
4
|
+
#
|
5
|
+
# Eclipse Public License version 1.0
|
6
|
+
# GNU General Public License version 2
|
7
|
+
# GNU Lesser General Public License version 2.1
|
8
|
+
|
9
|
+
if ENV.include? 'BENCH_9000_NATIVE'
|
10
|
+
require "oily_png/oily_png"
|
11
|
+
else
|
12
|
+
require "chunky_png"
|
13
|
+
end
|
14
|
+
|
15
|
+
PIXEL = 0x12345678
|
16
|
+
|
17
|
+
class MockCanvas
|
18
|
+
if ENV.include? 'BENCH_9000_NATIVE'
|
19
|
+
include OilyPNG::Operations
|
20
|
+
else
|
21
|
+
include ChunkyPNG::Canvas::Operations
|
22
|
+
end
|
23
|
+
|
24
|
+
public :compose!
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
@pixels = Array.new(width * height, 0)
|
28
|
+
|
29
|
+
@pixels.size.times do |n|
|
30
|
+
@pixels[n] = PIXEL
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def width
|
35
|
+
4000
|
36
|
+
end
|
37
|
+
|
38
|
+
def height
|
39
|
+
4000
|
40
|
+
end
|
41
|
+
|
42
|
+
def pixels
|
43
|
+
@pixels
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_pixel(x, y)
|
47
|
+
@pixels[y * width + x]
|
48
|
+
end
|
49
|
+
|
50
|
+
def set_pixel(x, y, color)
|
51
|
+
@pixels[y * width + x] = color
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def harness_input
|
56
|
+
[MockCanvas.new, MockCanvas.new]
|
57
|
+
end
|
58
|
+
|
59
|
+
def harness_sample(input)
|
60
|
+
onto, replace = input
|
61
|
+
onto.replace!(replace, 0, 0)
|
62
|
+
onto
|
63
|
+
end
|
64
|
+
|
65
|
+
def harness_verify(output)
|
66
|
+
output.pixels.inject(:+) == 4886718336000000
|
67
|
+
end
|
68
|
+
|
69
|
+
require 'bench9000/harness'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
diff --git a/lib/chunky_png/canvas/resampling.rb b/lib/chunky_png/canvas/resampling.rb
|
2
|
+
index e3d97ca..58c234a 100644
|
3
|
+
--- a/lib/chunky_png/canvas/resampling.rb
|
4
|
+
+++ b/lib/chunky_png/canvas/resampling.rb
|
5
|
+
@@ -80,7 +80,7 @@ module ChunkyPNG
|
6
|
+
steps_y = steps(height, new_height)
|
7
|
+
|
8
|
+
|
9
|
+
- pixels = Array(size=new_width*new_height)
|
10
|
+
+ pixels = Array.new(size=new_width*new_height)
|
11
|
+
i = 0
|
12
|
+
for y in steps_y
|
13
|
+
for x in steps_x
|
14
|
+
@@ -104,7 +104,7 @@ module ChunkyPNG
|
15
|
+
index_x, interp_x = steps_residues(width, new_width)
|
16
|
+
index_y, interp_y = steps_residues(height, new_height)
|
17
|
+
|
18
|
+
- pixels = Array(size=new_width*new_height)
|
19
|
+
+ pixels = Array.new(size=new_width*new_height)
|
20
|
+
i = 0
|
21
|
+
for y in 1..new_height
|
22
|
+
# Clamp the indicies to the edges of the image
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Copyright © 2004-2013 Brent Fulgham
|
2
|
+
#
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
# this list of conditions and the following disclaimer in the documentation
|
13
|
+
# and/or other materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# * Neither the name of "The Computer Language Benchmarks Game" nor the name
|
16
|
+
# of "The Computer Language Shootout Benchmarks" nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived from this
|
18
|
+
# software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
# The Computer Language Benchmarks Game
|
32
|
+
# http://benchmarksgame.alioth.debian.org
|
33
|
+
#
|
34
|
+
# contributed by Jesse Millikan
|
35
|
+
# Modified by Wesley Moxam
|
36
|
+
|
37
|
+
# http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=yarv&id=1
|
38
|
+
|
39
|
+
def item_check(left, item, right)
|
40
|
+
return item if left.nil?
|
41
|
+
item + item_check(*left) - item_check(*right)
|
42
|
+
end
|
43
|
+
|
44
|
+
def bottom_up_tree(item, depth)
|
45
|
+
return [nil, item, nil] unless depth > 0
|
46
|
+
item_item = 2 * item
|
47
|
+
depth -= 1
|
48
|
+
[bottom_up_tree(item_item - 1, depth), item, bottom_up_tree(item_item, depth)]
|
49
|
+
end
|
50
|
+
|
51
|
+
def binary_trees(max_depth)
|
52
|
+
sum = 0
|
53
|
+
|
54
|
+
min_depth = 4
|
55
|
+
|
56
|
+
max_depth = min_depth + 2 if min_depth + 2 > max_depth
|
57
|
+
|
58
|
+
stretch_depth = max_depth + 1
|
59
|
+
stretch_tree = bottom_up_tree(0, stretch_depth)
|
60
|
+
|
61
|
+
sum += item_check(*stretch_tree)
|
62
|
+
stretch_tree = nil
|
63
|
+
|
64
|
+
long_lived_tree = bottom_up_tree(0, max_depth)
|
65
|
+
|
66
|
+
min_depth.step(max_depth + 1, 2) do |depth|
|
67
|
+
iterations = 2**(max_depth - depth + min_depth)
|
68
|
+
|
69
|
+
check = 0
|
70
|
+
|
71
|
+
for i in 1..iterations
|
72
|
+
temp_tree = bottom_up_tree(i, depth)
|
73
|
+
check += item_check(*temp_tree)
|
74
|
+
|
75
|
+
temp_tree = bottom_up_tree(-i, depth)
|
76
|
+
check += item_check(*temp_tree)
|
77
|
+
end
|
78
|
+
|
79
|
+
sum += depth
|
80
|
+
sum += check
|
81
|
+
end
|
82
|
+
|
83
|
+
sum += item_check(*long_lived_tree)
|
84
|
+
|
85
|
+
sum
|
86
|
+
end
|
87
|
+
|
88
|
+
def harness_input
|
89
|
+
15
|
90
|
+
end
|
91
|
+
|
92
|
+
def harness_sample(input)
|
93
|
+
binary_trees(input)
|
94
|
+
end
|
95
|
+
|
96
|
+
def harness_verify(output)
|
97
|
+
output == -87308
|
98
|
+
end
|
99
|
+
|
100
|
+
require 'bench9000/harness'
|
@@ -0,0 +1,732 @@
|
|
1
|
+
# Port of deltablue.py, as documented below, to Ruby.
|
2
|
+
# Stefan Marr, 2014-04-28
|
3
|
+
#
|
4
|
+
# Was: deltablue.py
|
5
|
+
# =================
|
6
|
+
#
|
7
|
+
# Ported for the PyPy project.
|
8
|
+
# Contributed by Daniel Lindsley
|
9
|
+
#
|
10
|
+
# This implementation of the DeltaBlue benchmark was directly ported
|
11
|
+
# from the `V8's source code`_, which was in turn derived
|
12
|
+
# from the Smalltalk implementation by John Maloney and Mario
|
13
|
+
# Wolczko. The original Javascript implementation was licensed under the GPL.
|
14
|
+
#
|
15
|
+
# It's been updated in places to be more idiomatic to Python (for loops over
|
16
|
+
# collections, a couple magic methods, ``OrderedCollection`` being a list & things
|
17
|
+
# altering those collections changed to the builtin methods) but largely retains
|
18
|
+
# the layout & logic from the original. (Ugh.)
|
19
|
+
#
|
20
|
+
# .. _`V8's source code`: (http://code.google.com/p/v8/source/browse/branches/bleeding_edge/benchmarks/deltablue.js)
|
21
|
+
|
22
|
+
|
23
|
+
# HOORAY FOR GLOBALS... Oh wait.
|
24
|
+
# In spirit of the original, we'll keep it, but ugh.
|
25
|
+
$planner = nil
|
26
|
+
|
27
|
+
class Strength
|
28
|
+
attr_accessor :strength
|
29
|
+
|
30
|
+
def initialize(strength, name)
|
31
|
+
@strength = strength
|
32
|
+
@name = name
|
33
|
+
end
|
34
|
+
|
35
|
+
REQUIRED = self.new(0, "required")
|
36
|
+
STRONG_PREFERRED = self.new(1, "strongPreferred")
|
37
|
+
PREFERRED = self.new(2, "preferred")
|
38
|
+
STRONG_DEFAULT = self.new(3, "strongDefault")
|
39
|
+
NORMAL = self.new(4, "normal")
|
40
|
+
WEAK_DEFAULT = self.new(5, "weakDefault")
|
41
|
+
WEAKEST = self.new(6, "weakest")
|
42
|
+
|
43
|
+
def self.stronger(s1, s2)
|
44
|
+
s1.strength < s2.strength
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.weaker(s1, s2)
|
48
|
+
s1.strength > s2.strength
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.weakest_of(s1, s2)
|
52
|
+
if self.weaker(s1, s2)
|
53
|
+
return s1
|
54
|
+
end
|
55
|
+
return s2
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.strongest(s1, s2)
|
59
|
+
if self.stronger(s1, s2)
|
60
|
+
return s1
|
61
|
+
end
|
62
|
+
return s2
|
63
|
+
end
|
64
|
+
|
65
|
+
def next_weaker
|
66
|
+
case @strength
|
67
|
+
when 0
|
68
|
+
WEAKEST
|
69
|
+
when 1
|
70
|
+
WEAK_DEFAULT
|
71
|
+
when 2
|
72
|
+
NORMAL
|
73
|
+
when 3
|
74
|
+
STRONG_DEFAULT
|
75
|
+
when 4
|
76
|
+
PREFERRED
|
77
|
+
when 5
|
78
|
+
# TODO: This looks like a bug in the original code. Shouldn't this be
|
79
|
+
# ``STRONG_PREFERRED? Keeping for porting sake...
|
80
|
+
REQUIRED
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
class Constraint
|
87
|
+
attr_accessor :strength
|
88
|
+
|
89
|
+
def initialize(strength)
|
90
|
+
@strength = strength
|
91
|
+
end
|
92
|
+
|
93
|
+
def add_constraint
|
94
|
+
add_to_graph
|
95
|
+
$planner.incremental_add(self)
|
96
|
+
end
|
97
|
+
|
98
|
+
def satisfy(mark)
|
99
|
+
choose_method(mark)
|
100
|
+
|
101
|
+
if not is_satisfied
|
102
|
+
if @strength == Strength::REQUIRED
|
103
|
+
puts 'Could not satisfy a required constraint!'
|
104
|
+
end
|
105
|
+
return nil
|
106
|
+
end
|
107
|
+
|
108
|
+
mark_inputs(mark)
|
109
|
+
out = output
|
110
|
+
overridden = out.determined_by
|
111
|
+
|
112
|
+
unless overridden.nil?
|
113
|
+
overridden.mark_unsatisfied
|
114
|
+
end
|
115
|
+
|
116
|
+
out.determined_by = self
|
117
|
+
|
118
|
+
unless $planner.add_propagate(self, mark)
|
119
|
+
puts 'Cycle encountered'
|
120
|
+
end
|
121
|
+
|
122
|
+
out.mark = mark
|
123
|
+
overridden
|
124
|
+
end
|
125
|
+
|
126
|
+
def destroy_constraint
|
127
|
+
if is_satisfied
|
128
|
+
$planner.incremental_remove(self)
|
129
|
+
else
|
130
|
+
remove_from_graph
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def is_input
|
135
|
+
false
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class UnaryConstraint < Constraint
|
140
|
+
def initialize(v, strength)
|
141
|
+
super(strength)
|
142
|
+
@my_output = v
|
143
|
+
@satisfied = false
|
144
|
+
add_constraint
|
145
|
+
end
|
146
|
+
|
147
|
+
def add_to_graph
|
148
|
+
@my_output.add_constraint(self)
|
149
|
+
@satisfied = false
|
150
|
+
end
|
151
|
+
|
152
|
+
def choose_method(mark)
|
153
|
+
if @my_output.mark != mark and Strength.stronger(@strength, @my_output.walk_strength)
|
154
|
+
@satisfied = true
|
155
|
+
else
|
156
|
+
@satisfied = false
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def is_satisfied
|
161
|
+
@satisfied
|
162
|
+
end
|
163
|
+
|
164
|
+
def mark_inputs(mark)
|
165
|
+
# No-ops.
|
166
|
+
end
|
167
|
+
|
168
|
+
def output
|
169
|
+
# Ugh. Keeping it for consistency with the original. So much for
|
170
|
+
# "we're all adults here"...
|
171
|
+
@my_output
|
172
|
+
end
|
173
|
+
|
174
|
+
def recalculate
|
175
|
+
@my_output.walk_strength = @strength
|
176
|
+
@my_output.stay = !is_input
|
177
|
+
|
178
|
+
if @my_output.stay
|
179
|
+
execute
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def mark_unsatisfied
|
184
|
+
@satisfied = false
|
185
|
+
end
|
186
|
+
|
187
|
+
def inputs_known(mark)
|
188
|
+
true
|
189
|
+
end
|
190
|
+
|
191
|
+
def remove_from_graph
|
192
|
+
unless @my_output.nil?
|
193
|
+
@my_output.remove_constraint(self)
|
194
|
+
@satisfied = false
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
class StayConstraint < UnaryConstraint
|
200
|
+
def execute
|
201
|
+
# The methods, THEY DO NOTHING.
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
class EditConstraint < UnaryConstraint
|
207
|
+
def is_input
|
208
|
+
true
|
209
|
+
end
|
210
|
+
|
211
|
+
def execute
|
212
|
+
# This constraint also does nothing.
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
|
217
|
+
class Direction
|
218
|
+
# Hooray for things that ought to be structs!
|
219
|
+
NONE = 0
|
220
|
+
FORWARD = 1
|
221
|
+
BACKWARD = -1
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
class BinaryConstraint < Constraint
|
226
|
+
def initialize(v1, v2, strength)
|
227
|
+
super(strength)
|
228
|
+
@v1 = v1
|
229
|
+
@v2 = v2
|
230
|
+
@direction = Direction::NONE
|
231
|
+
add_constraint
|
232
|
+
end
|
233
|
+
|
234
|
+
def choose_method(mark)
|
235
|
+
if @v1.mark == mark
|
236
|
+
if @v2.mark != mark and Strength::stronger(@strength, @v2.walk_strength)
|
237
|
+
@direction = Direction::FORWARD
|
238
|
+
else
|
239
|
+
@direction = Direction::BACKWARD
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
if @v2.mark == mark
|
244
|
+
if @v1.mark != mark and Strength::stronger(@strength, @v1.walk_strength)
|
245
|
+
@direction = Direction::BACKWARD
|
246
|
+
else
|
247
|
+
@direction = Direction::NONE
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
if Strength.weaker(@v1.walk_strength, @v2.walk_strength)
|
252
|
+
if Strength.stronger(@strength, @v1.walk_strength)
|
253
|
+
@direction = Direction::BACKWARD
|
254
|
+
else
|
255
|
+
@direction = Direction::NONE
|
256
|
+
end
|
257
|
+
else
|
258
|
+
if Strength.stronger(@strength, @v2.walk_strength)
|
259
|
+
@direction = Direction::FORWARD
|
260
|
+
else
|
261
|
+
@direction = Direction::BACKWARD
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
def add_to_graph
|
267
|
+
@v1.add_constraint(self)
|
268
|
+
@v2.add_constraint(self)
|
269
|
+
@direction = Direction::NONE
|
270
|
+
end
|
271
|
+
|
272
|
+
def is_satisfied
|
273
|
+
@direction != Direction::NONE
|
274
|
+
end
|
275
|
+
|
276
|
+
def mark_inputs(mark)
|
277
|
+
input.mark = mark
|
278
|
+
end
|
279
|
+
|
280
|
+
def input
|
281
|
+
if @direction == Direction::FORWARD
|
282
|
+
return @v1
|
283
|
+
end
|
284
|
+
|
285
|
+
@v2
|
286
|
+
end
|
287
|
+
|
288
|
+
def output
|
289
|
+
if @direction == Direction::FORWARD
|
290
|
+
return @v2
|
291
|
+
end
|
292
|
+
|
293
|
+
@v1
|
294
|
+
end
|
295
|
+
|
296
|
+
def recalculate
|
297
|
+
ihn = input
|
298
|
+
out = output
|
299
|
+
out.walk_strength = Strength.weakest_of(@strength, ihn.walk_strength)
|
300
|
+
out.stay = ihn.stay
|
301
|
+
|
302
|
+
if out.stay
|
303
|
+
execute
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
def mark_unsatisfied
|
308
|
+
@direction = Direction::NONE
|
309
|
+
end
|
310
|
+
|
311
|
+
def inputs_known(mark)
|
312
|
+
i = input
|
313
|
+
i.mark == mark or i.stay or i.determined_by.nil?
|
314
|
+
end
|
315
|
+
|
316
|
+
def remove_from_graph
|
317
|
+
unless @v1.nil?
|
318
|
+
@v1.remove_constraint(self)
|
319
|
+
end
|
320
|
+
|
321
|
+
unless @v2.nil?
|
322
|
+
@v2.remove_constraint(self)
|
323
|
+
end
|
324
|
+
|
325
|
+
@direction = Direction::NONE
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
class ScaleConstraint < BinaryConstraint
|
330
|
+
def initialize(src, scale, offset, dest, strength)
|
331
|
+
@direction = Direction::NONE
|
332
|
+
@scale = scale
|
333
|
+
@offset = offset
|
334
|
+
super(src, dest, strength)
|
335
|
+
end
|
336
|
+
|
337
|
+
def add_to_graph
|
338
|
+
super
|
339
|
+
@scale.add_constraint(self)
|
340
|
+
@offset.add_constraint(self)
|
341
|
+
end
|
342
|
+
|
343
|
+
def remove_from_graph
|
344
|
+
super
|
345
|
+
|
346
|
+
unless @scale.nil?
|
347
|
+
@scale.remove_constraint(self)
|
348
|
+
end
|
349
|
+
|
350
|
+
unless @offset.nil?
|
351
|
+
@offset.remove_constraint(self)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
def mark_inputs(mark)
|
356
|
+
super
|
357
|
+
@scale.mark = mark
|
358
|
+
@offset.mark = mark
|
359
|
+
end
|
360
|
+
|
361
|
+
def execute
|
362
|
+
if @direction == Direction::FORWARD
|
363
|
+
@v2.value = @v1.value * @scale.value + @offset.value
|
364
|
+
else
|
365
|
+
@v1.value = (@v2.value - @offset.value) / @scale.value
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
def recalculate
|
370
|
+
ihn = input
|
371
|
+
out = output
|
372
|
+
out.walk_strength = Strength.weakest_of(@strength, ihn.walk_strength)
|
373
|
+
out.stay = (ihn.stay and @scale.stay and @offset.stay)
|
374
|
+
|
375
|
+
if out.stay
|
376
|
+
execute
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
|
382
|
+
class EqualityConstraint < BinaryConstraint
|
383
|
+
def execute
|
384
|
+
output.value = input.value
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
class Variable
|
389
|
+
attr_accessor :mark
|
390
|
+
attr_accessor :walk_strength
|
391
|
+
attr_accessor :determined_by
|
392
|
+
attr_accessor :stay
|
393
|
+
attr_accessor :value
|
394
|
+
attr_accessor :constraints
|
395
|
+
|
396
|
+
def initialize(name, initial_value = 0)
|
397
|
+
@name = name
|
398
|
+
@value = initial_value
|
399
|
+
@constraints = []
|
400
|
+
@determined_by = nil
|
401
|
+
@mark = 0
|
402
|
+
@walk_strength = Strength::WEAKEST
|
403
|
+
@stay = true
|
404
|
+
end
|
405
|
+
|
406
|
+
def inspect
|
407
|
+
# To make debugging this beast from pdb easier...
|
408
|
+
return "<Variable: #{@name} - #{value}>"
|
409
|
+
end
|
410
|
+
|
411
|
+
def add_constraint(constraint)
|
412
|
+
@constraints << constraint
|
413
|
+
end
|
414
|
+
|
415
|
+
def remove_constraint(constraint)
|
416
|
+
@constraints.delete(constraint)
|
417
|
+
|
418
|
+
if @determined_by == constraint
|
419
|
+
@determined_by = nil
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
|
425
|
+
class Planner
|
426
|
+
def initialize
|
427
|
+
@current_mark = 0
|
428
|
+
end
|
429
|
+
|
430
|
+
def incremental_add(constraint)
|
431
|
+
mark = new_mark
|
432
|
+
overridden = constraint.satisfy(mark)
|
433
|
+
|
434
|
+
until overridden.nil?
|
435
|
+
overridden = overridden.satisfy(mark)
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
def incremental_remove(constraint)
|
440
|
+
out = constraint.output
|
441
|
+
constraint.mark_unsatisfied
|
442
|
+
constraint.remove_from_graph
|
443
|
+
unsatisfied = remove_propagate_from(out)
|
444
|
+
strength = Strength::REQUIRED
|
445
|
+
|
446
|
+
loop do
|
447
|
+
for u in unsatisfied
|
448
|
+
if u.strength == strength
|
449
|
+
incremental_add(u)
|
450
|
+
end
|
451
|
+
|
452
|
+
strength = strength.next_weaker
|
453
|
+
end
|
454
|
+
break if strength != Strength::WEAKEST
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
def new_mark
|
459
|
+
@current_mark += 1
|
460
|
+
@current_mark
|
461
|
+
end
|
462
|
+
|
463
|
+
def make_plan(sources)
|
464
|
+
mark = new_mark
|
465
|
+
plan = Plan.new()
|
466
|
+
todo = sources
|
467
|
+
|
468
|
+
until todo.empty?
|
469
|
+
c = todo.pop
|
470
|
+
|
471
|
+
if c.output.mark != mark and c.inputs_known(mark)
|
472
|
+
plan.add_constraint(c)
|
473
|
+
c.output.mark = mark
|
474
|
+
add_constraints_consuming_to(c.output, todo)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
plan
|
479
|
+
end
|
480
|
+
|
481
|
+
def extract_plan_from_constraints(constraints)
|
482
|
+
sources = []
|
483
|
+
|
484
|
+
for c in constraints
|
485
|
+
if c.is_input and c.is_satisfied
|
486
|
+
sources << c
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
make_plan(sources)
|
491
|
+
end
|
492
|
+
|
493
|
+
def add_propagate(c, mark)
|
494
|
+
todo = []
|
495
|
+
todo << c
|
496
|
+
|
497
|
+
until todo.empty?
|
498
|
+
d = todo.pop
|
499
|
+
|
500
|
+
if d.output.mark == mark
|
501
|
+
incremental_remove(c)
|
502
|
+
return false
|
503
|
+
end
|
504
|
+
|
505
|
+
d.recalculate
|
506
|
+
add_constraints_consuming_to(d.output, todo)
|
507
|
+
end
|
508
|
+
|
509
|
+
true
|
510
|
+
end
|
511
|
+
|
512
|
+
def remove_propagate_from(out)
|
513
|
+
out.determined_by = nil
|
514
|
+
out.walk_strength = Strength::WEAKEST
|
515
|
+
out.stay = true
|
516
|
+
unsatisfied = []
|
517
|
+
todo = []
|
518
|
+
todo << out
|
519
|
+
|
520
|
+
until todo.empty?
|
521
|
+
v = todo.pop
|
522
|
+
|
523
|
+
for c in v.constraints
|
524
|
+
unless c.is_satisfied
|
525
|
+
unsatisfied << c
|
526
|
+
end
|
527
|
+
end
|
528
|
+
|
529
|
+
determining = v.determined_by
|
530
|
+
|
531
|
+
for c in v.constraints
|
532
|
+
if c != determining and c.is_satisfied
|
533
|
+
c.recalculate
|
534
|
+
todo << c.output
|
535
|
+
end
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
539
|
+
unsatisfied
|
540
|
+
end
|
541
|
+
|
542
|
+
def add_constraints_consuming_to(v, coll)
|
543
|
+
determining = v.determined_by
|
544
|
+
cc = v.constraints
|
545
|
+
|
546
|
+
for c in cc
|
547
|
+
if c != determining and c.is_satisfied
|
548
|
+
# I guess we're just updating a reference (``coll``)? Seems
|
549
|
+
# inconsistent with the rest of the implementation, where they
|
550
|
+
# return the lists...
|
551
|
+
coll << c
|
552
|
+
end
|
553
|
+
end
|
554
|
+
end
|
555
|
+
end
|
556
|
+
|
557
|
+
|
558
|
+
class Plan
|
559
|
+
def initialize
|
560
|
+
@v = []
|
561
|
+
end
|
562
|
+
|
563
|
+
def add_constraint(c)
|
564
|
+
@v << c
|
565
|
+
end
|
566
|
+
|
567
|
+
def size
|
568
|
+
@v.size
|
569
|
+
end
|
570
|
+
|
571
|
+
def [](index)
|
572
|
+
@v[index]
|
573
|
+
end
|
574
|
+
|
575
|
+
def execute
|
576
|
+
for c in @v
|
577
|
+
c.execute
|
578
|
+
end
|
579
|
+
end
|
580
|
+
end
|
581
|
+
|
582
|
+
|
583
|
+
# Main
|
584
|
+
|
585
|
+
def chain_test(n)
|
586
|
+
|
587
|
+
# This is the standard DeltaBlue benchmark. A long chain of equality
|
588
|
+
# constraints is constructed with a stay constraint on one end. An
|
589
|
+
# edit constraint is then added to the opposite end and the time is
|
590
|
+
# measured for adding and removing this constraint, and extracting
|
591
|
+
# and executing a constraint satisfaction plan. There are two cases.
|
592
|
+
# In case 1, the added constraint is stronger than the stay
|
593
|
+
# constraint and values must propagate down the entire length of the
|
594
|
+
# chain. In case 2, the added constraint is weaker than the stay
|
595
|
+
# constraint so it cannot be accomodated. The cost in this case is,
|
596
|
+
# of course, very low. Typical situations lie somewhere between these
|
597
|
+
# two extremes.
|
598
|
+
|
599
|
+
$planner = Planner.new
|
600
|
+
prev, first, last = nil, nil, nil
|
601
|
+
|
602
|
+
# We need to go up to n inclusively.
|
603
|
+
for i in 0..n
|
604
|
+
#name = "v%s" % i
|
605
|
+
name = sprintf "v%s", i
|
606
|
+
v = Variable.new(name)
|
607
|
+
|
608
|
+
unless prev.nil?
|
609
|
+
EqualityConstraint.new(prev, v, Strength::REQUIRED)
|
610
|
+
end
|
611
|
+
|
612
|
+
if i == 0
|
613
|
+
first = v
|
614
|
+
end
|
615
|
+
|
616
|
+
if i == n
|
617
|
+
last = v
|
618
|
+
end
|
619
|
+
|
620
|
+
prev = v
|
621
|
+
end
|
622
|
+
|
623
|
+
StayConstraint.new(last, Strength::STRONG_DEFAULT)
|
624
|
+
edit = EditConstraint.new(first, Strength::PREFERRED)
|
625
|
+
edits = []
|
626
|
+
edits << edit
|
627
|
+
plan = $planner.extract_plan_from_constraints(edits)
|
628
|
+
|
629
|
+
for i in 0..99
|
630
|
+
first.value = i
|
631
|
+
plan.execute
|
632
|
+
|
633
|
+
if last.value != i
|
634
|
+
puts 'Chain test failed.'
|
635
|
+
exit
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
640
|
+
def projection_test(n)
|
641
|
+
# This test constructs a two sets of variables related to each
|
642
|
+
# other by a simple linear transformation (scale and offset). The
|
643
|
+
# time is measured to change a variable on either side of the
|
644
|
+
# mapping and to change the scale and offset factors.
|
645
|
+
|
646
|
+
$planner = Planner.new
|
647
|
+
scale = Variable.new("scale", 10)
|
648
|
+
offset = Variable.new("offset", 1000)
|
649
|
+
src, dst = nil, nil
|
650
|
+
|
651
|
+
dests = []
|
652
|
+
|
653
|
+
for i in 0..(n - 1)
|
654
|
+
#src = Variable.new("src%s" % i, i)
|
655
|
+
src = Variable.new(sprintf("src%s", i), i)
|
656
|
+
#dst = Variable.new("dst%s" % i, i)
|
657
|
+
dst = Variable.new(sprintf("dst%s", i), i)
|
658
|
+
dests << dst
|
659
|
+
StayConstraint.new(src, Strength::NORMAL)
|
660
|
+
ScaleConstraint.new(src, scale, offset, dst, Strength::REQUIRED)
|
661
|
+
end
|
662
|
+
|
663
|
+
change(src, 17)
|
664
|
+
|
665
|
+
if dst.value != 1170
|
666
|
+
puts 'Projection 1 failed'
|
667
|
+
exit
|
668
|
+
end
|
669
|
+
|
670
|
+
change(dst, 1050)
|
671
|
+
|
672
|
+
if src.value != 5
|
673
|
+
puts 'Projection 2 failed'
|
674
|
+
exit
|
675
|
+
end
|
676
|
+
|
677
|
+
change(scale, 5)
|
678
|
+
|
679
|
+
for i in 0..(n - 2)
|
680
|
+
if dests[i].value != (i * 5 + 1000)
|
681
|
+
puts 'Projection 3 failed'
|
682
|
+
exit
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
change(offset, 2000)
|
687
|
+
|
688
|
+
for i in 0..(n - 2)
|
689
|
+
if dests[i].value != (i * 5 + 2000)
|
690
|
+
puts 'Projection 4 failed'
|
691
|
+
exit
|
692
|
+
end
|
693
|
+
end
|
694
|
+
end
|
695
|
+
|
696
|
+
|
697
|
+
def change(v, new_value)
|
698
|
+
edit = EditConstraint.new(v, Strength::PREFERRED)
|
699
|
+
edits = []
|
700
|
+
edits << edit
|
701
|
+
|
702
|
+
plan = $planner.extract_plan_from_constraints(edits)
|
703
|
+
|
704
|
+
for i in 0..9
|
705
|
+
v.value = new_value
|
706
|
+
plan.execute
|
707
|
+
end
|
708
|
+
|
709
|
+
edit.destroy_constraint
|
710
|
+
end
|
711
|
+
|
712
|
+
|
713
|
+
def run(iterations)
|
714
|
+
chain_test(iterations)
|
715
|
+
projection_test(iterations)
|
716
|
+
end
|
717
|
+
|
718
|
+
|
719
|
+
def harness_input
|
720
|
+
10_000
|
721
|
+
end
|
722
|
+
|
723
|
+
def harness_sample(input)
|
724
|
+
run(input)
|
725
|
+
end
|
726
|
+
|
727
|
+
def harness_verify(output)
|
728
|
+
# Self-verifies
|
729
|
+
true
|
730
|
+
end
|
731
|
+
|
732
|
+
require 'bench9000/harness'
|