bench9000 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (719) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +7 -0
  3. data/benchmarks/chunky_png/chunky-canvas-resampling-bilinear.rb +69 -0
  4. data/benchmarks/chunky_png/chunky-canvas-resampling-nearest-neighbor.rb +68 -0
  5. data/benchmarks/chunky_png/chunky-canvas-resampling-steps-residues.rb +37 -0
  6. data/benchmarks/chunky_png/chunky-canvas-resampling-steps.rb +37 -0
  7. data/benchmarks/chunky_png/chunky-color-a.rb +39 -0
  8. data/benchmarks/chunky_png/chunky-color-b.rb +39 -0
  9. data/benchmarks/chunky_png/chunky-color-compose-quick.rb +39 -0
  10. data/benchmarks/chunky_png/chunky-color-g.rb +39 -0
  11. data/benchmarks/chunky_png/chunky-color-r.rb +39 -0
  12. data/benchmarks/chunky_png/chunky-decode-png-image-pass.rb +74 -0
  13. data/benchmarks/chunky_png/chunky-encode-png-image-pass-to-stream.rb +84 -0
  14. data/benchmarks/chunky_png/chunky-operations-compose.rb +70 -0
  15. data/benchmarks/chunky_png/chunky-operations-replace.rb +69 -0
  16. data/benchmarks/chunky_png/chunky_png.patch +22 -0
  17. data/benchmarks/chunky_png/version.txt +2 -0
  18. data/benchmarks/classic/binary-trees.rb +100 -0
  19. data/benchmarks/classic/deltablue.rb +732 -0
  20. data/benchmarks/classic/fannkuch-redux.rb +111 -0
  21. data/benchmarks/classic/fasta-string.rb +71 -0
  22. data/benchmarks/classic/mandelbrot.rb +112 -0
  23. data/benchmarks/classic/matrix-multiply.rb +78 -0
  24. data/benchmarks/classic/n-body.rb +188 -0
  25. data/benchmarks/classic/pidigits.rb +88 -0
  26. data/benchmarks/classic/red-black.rb +363 -0
  27. data/benchmarks/classic/richards-kwargs.rb +403 -0
  28. data/benchmarks/classic/richards.rb +403 -0
  29. data/benchmarks/classic/spectral-norm.rb +95 -0
  30. data/benchmarks/default.config.rb +206 -0
  31. data/benchmarks/graph/connected.rb +62 -0
  32. data/benchmarks/literature/acid.rb +46 -0
  33. data/benchmarks/micro/pack-big-U-loop.rb +24 -0
  34. data/benchmarks/micro/pack-big-xLX-repeat.rb +22 -0
  35. data/benchmarks/micro/pack-small-mixture.rb +17 -0
  36. data/benchmarks/micro/string-equal.rb +28 -0
  37. data/benchmarks/octane/deltablue.rb +981 -0
  38. data/benchmarks/psd.rb/mock-logger.rb +23 -0
  39. data/benchmarks/psd.rb/psd-color-cmyk-to-rgb.rb +46 -0
  40. data/benchmarks/psd.rb/psd-compose-color-burn.rb +43 -0
  41. data/benchmarks/psd.rb/psd-compose-color-dodge.rb +43 -0
  42. data/benchmarks/psd.rb/psd-compose-darken.rb +43 -0
  43. data/benchmarks/psd.rb/psd-compose-difference.rb +43 -0
  44. data/benchmarks/psd.rb/psd-compose-exclusion.rb +43 -0
  45. data/benchmarks/psd.rb/psd-compose-hard-light.rb +43 -0
  46. data/benchmarks/psd.rb/psd-compose-hard-mix.rb +43 -0
  47. data/benchmarks/psd.rb/psd-compose-lighten.rb +43 -0
  48. data/benchmarks/psd.rb/psd-compose-linear-burn.rb +43 -0
  49. data/benchmarks/psd.rb/psd-compose-linear-dodge.rb +43 -0
  50. data/benchmarks/psd.rb/psd-compose-linear-light.rb +43 -0
  51. data/benchmarks/psd.rb/psd-compose-multiply.rb +43 -0
  52. data/benchmarks/psd.rb/psd-compose-normal.rb +43 -0
  53. data/benchmarks/psd.rb/psd-compose-overlay.rb +43 -0
  54. data/benchmarks/psd.rb/psd-compose-pin-light.rb +43 -0
  55. data/benchmarks/psd.rb/psd-compose-screen.rb +43 -0
  56. data/benchmarks/psd.rb/psd-compose-soft-light.rb +43 -0
  57. data/benchmarks/psd.rb/psd-compose-vivid-light.rb +43 -0
  58. data/benchmarks/psd.rb/psd-imageformat-layerraw-parse-raw.rb +70 -0
  59. data/benchmarks/psd.rb/psd-imageformat-rle-decode-rle-channel.rb +87 -0
  60. data/benchmarks/psd.rb/psd-imagemode-cmyk-combine-cmyk-channel.rb +65 -0
  61. data/benchmarks/psd.rb/psd-imagemode-greyscale-combine-greyscale-channel.rb +68 -0
  62. data/benchmarks/psd.rb/psd-imagemode-rgb-combine-rgb-channel.rb +65 -0
  63. data/benchmarks/psd.rb/psd-renderer-blender-compose.rb +113 -0
  64. data/benchmarks/psd.rb/psd-renderer-clippingmask-apply.rb +129 -0
  65. data/benchmarks/psd.rb/psd-renderer-mask-apply.rb +137 -0
  66. data/benchmarks/psd.rb/psd-util-clamp.rb +42 -0
  67. data/benchmarks/psd.rb/psd-util-pad2.rb +42 -0
  68. data/benchmarks/psd.rb/psd-util-pad4.rb +42 -0
  69. data/benchmarks/psd.rb/psd_native.patch +99 -0
  70. data/benchmarks/psd.rb/version.txt +2 -0
  71. data/benchmarks/topaz/neural-net.rb +208 -0
  72. data/benchmarks/vm/codeload.rb +35 -0
  73. data/benchmarks/vm/fixtures/codeload/LICENSE.txt +25 -0
  74. data/benchmarks/vm/fixtures/codeload/lexer.rb +21493 -0
  75. data/bin/bench9000 +13 -0
  76. data/example/report.data +945 -0
  77. data/example/report.html +59178 -0
  78. data/lib/bench9000.rb +27 -0
  79. data/lib/bench9000/benchmark.rb +29 -0
  80. data/lib/bench9000/commands/command.rb +30 -0
  81. data/lib/bench9000/commands/compare-reference.rb +70 -0
  82. data/lib/bench9000/commands/compare.rb +43 -0
  83. data/lib/bench9000/commands/detail.rb +51 -0
  84. data/lib/bench9000/commands/list-benchmarks.rb +29 -0
  85. data/lib/bench9000/commands/list-implementations.rb +29 -0
  86. data/lib/bench9000/commands/reference.rb +46 -0
  87. data/lib/bench9000/commands/remove.rb +41 -0
  88. data/lib/bench9000/commands/report.rb +71 -0
  89. data/lib/bench9000/commands/score.rb +27 -0
  90. data/lib/bench9000/config.rb +88 -0
  91. data/lib/bench9000/group.rb +23 -0
  92. data/lib/bench9000/harness.rb +68 -0
  93. data/lib/bench9000/implementation.rb +134 -0
  94. data/lib/bench9000/json-formatter.rb +50 -0
  95. data/lib/bench9000/main.rb +268 -0
  96. data/lib/bench9000/measurement.rb +75 -0
  97. data/lib/bench9000/micro-harness.rb +39 -0
  98. data/lib/bench9000/options.rb +31 -0
  99. data/lib/bench9000/report/bootstrap-theme.css +5 -0
  100. data/lib/bench9000/report/bootstrap.css +5 -0
  101. data/lib/bench9000/report/bootstrap.js +6 -0
  102. data/lib/bench9000/report/chart.js +3432 -0
  103. data/lib/bench9000/report/chartjs.patch +91 -0
  104. data/lib/bench9000/report/jquery.js +4 -0
  105. data/lib/bench9000/report/report.html +177 -0
  106. data/lib/bench9000/report/report.js +547 -0
  107. data/lib/bench9000/stats.rb +41 -0
  108. data/readme.md +205 -0
  109. data/vendor/chunky_png/BENCHMARKS.rdoc +31 -0
  110. data/vendor/chunky_png/Gemfile +10 -0
  111. data/vendor/chunky_png/LICENSE +20 -0
  112. data/vendor/chunky_png/README.rdoc +84 -0
  113. data/vendor/chunky_png/Rakefile +11 -0
  114. data/vendor/chunky_png/benchmarks/decoding_benchmark.rb +36 -0
  115. data/vendor/chunky_png/benchmarks/encoding_benchmark.rb +40 -0
  116. data/vendor/chunky_png/benchmarks/filesize_benchmark.rb +28 -0
  117. data/vendor/chunky_png/chunky_png.gemspec +47 -0
  118. data/vendor/chunky_png/lib/chunky_png.rb +160 -0
  119. data/vendor/chunky_png/lib/chunky_png/canvas.rb +372 -0
  120. data/vendor/chunky_png/lib/chunky_png/canvas/adam7_interlacing.rb +72 -0
  121. data/vendor/chunky_png/lib/chunky_png/canvas/data_url_exporting.rb +15 -0
  122. data/vendor/chunky_png/lib/chunky_png/canvas/data_url_importing.rb +21 -0
  123. data/vendor/chunky_png/lib/chunky_png/canvas/drawing.rb +338 -0
  124. data/vendor/chunky_png/lib/chunky_png/canvas/masking.rb +91 -0
  125. data/vendor/chunky_png/lib/chunky_png/canvas/operations.rb +395 -0
  126. data/vendor/chunky_png/lib/chunky_png/canvas/png_decoding.rb +492 -0
  127. data/vendor/chunky_png/lib/chunky_png/canvas/png_encoding.rb +442 -0
  128. data/vendor/chunky_png/lib/chunky_png/canvas/resampling.rb +147 -0
  129. data/vendor/chunky_png/lib/chunky_png/canvas/stream_exporting.rb +58 -0
  130. data/vendor/chunky_png/lib/chunky_png/canvas/stream_importing.rb +77 -0
  131. data/vendor/chunky_png/lib/chunky_png/chunk.rb +328 -0
  132. data/vendor/chunky_png/lib/chunky_png/color.rb +780 -0
  133. data/vendor/chunky_png/lib/chunky_png/compatibility.rb +15 -0
  134. data/vendor/chunky_png/lib/chunky_png/datastream.rb +185 -0
  135. data/vendor/chunky_png/lib/chunky_png/dimension.rb +113 -0
  136. data/vendor/chunky_png/lib/chunky_png/image.rb +79 -0
  137. data/vendor/chunky_png/lib/chunky_png/palette.rb +209 -0
  138. data/vendor/chunky_png/lib/chunky_png/point.rb +115 -0
  139. data/vendor/chunky_png/lib/chunky_png/rmagick.rb +43 -0
  140. data/vendor/chunky_png/lib/chunky_png/vector.rb +186 -0
  141. data/vendor/chunky_png/lib/chunky_png/version.rb +5 -0
  142. data/vendor/chunky_png/spec/chunky_png/canvas/adam7_interlacing_spec.rb +106 -0
  143. data/vendor/chunky_png/spec/chunky_png/canvas/data_url_exporting_spec.rb +13 -0
  144. data/vendor/chunky_png/spec/chunky_png/canvas/data_url_importing_spec.rb +15 -0
  145. data/vendor/chunky_png/spec/chunky_png/canvas/drawing_spec.rb +170 -0
  146. data/vendor/chunky_png/spec/chunky_png/canvas/masking_spec.rb +51 -0
  147. data/vendor/chunky_png/spec/chunky_png/canvas/operations_spec.rb +388 -0
  148. data/vendor/chunky_png/spec/chunky_png/canvas/png_decoding_spec.rb +97 -0
  149. data/vendor/chunky_png/spec/chunky_png/canvas/png_encoding_spec.rb +235 -0
  150. data/vendor/chunky_png/spec/chunky_png/canvas/resampling_spec.rb +121 -0
  151. data/vendor/chunky_png/spec/chunky_png/canvas/stream_exporting_spec.rb +59 -0
  152. data/vendor/chunky_png/spec/chunky_png/canvas/stream_importing_spec.rb +31 -0
  153. data/vendor/chunky_png/spec/chunky_png/canvas_spec.rb +226 -0
  154. data/vendor/chunky_png/spec/chunky_png/color_spec.rb +251 -0
  155. data/vendor/chunky_png/spec/chunky_png/datastream_spec.rb +32 -0
  156. data/vendor/chunky_png/spec/chunky_png/dimension_spec.rb +48 -0
  157. data/vendor/chunky_png/spec/chunky_png/image_spec.rb +25 -0
  158. data/vendor/chunky_png/spec/chunky_png/point_spec.rb +76 -0
  159. data/vendor/chunky_png/spec/chunky_png/rmagick_spec.rb +23 -0
  160. data/vendor/chunky_png/spec/chunky_png/vector_spec.rb +104 -0
  161. data/vendor/chunky_png/spec/chunky_png_spec.rb +8 -0
  162. data/vendor/chunky_png/spec/png_suite/background_chunks/bgai4a08.png +0 -0
  163. data/vendor/chunky_png/spec/png_suite/background_chunks/bgai4a16.png +0 -0
  164. data/vendor/chunky_png/spec/png_suite/background_chunks/bgan6a08.png +0 -0
  165. data/vendor/chunky_png/spec/png_suite/background_chunks/bgan6a16.png +0 -0
  166. data/vendor/chunky_png/spec/png_suite/background_chunks/bgbn4a08.png +0 -0
  167. data/vendor/chunky_png/spec/png_suite/background_chunks/bggn4a16.png +0 -0
  168. data/vendor/chunky_png/spec/png_suite/background_chunks/bgwn6a08.png +0 -0
  169. data/vendor/chunky_png/spec/png_suite/background_chunks/bgyn6a16.png +0 -0
  170. data/vendor/chunky_png/spec/png_suite/basic/basi0g01.png +0 -0
  171. data/vendor/chunky_png/spec/png_suite/basic/basi0g01.rgba +0 -0
  172. data/vendor/chunky_png/spec/png_suite/basic/basi0g02.png +0 -0
  173. data/vendor/chunky_png/spec/png_suite/basic/basi0g02.rgba +0 -0
  174. data/vendor/chunky_png/spec/png_suite/basic/basi0g04.png +0 -0
  175. data/vendor/chunky_png/spec/png_suite/basic/basi0g04.rgba +0 -0
  176. data/vendor/chunky_png/spec/png_suite/basic/basi0g08.png +0 -0
  177. data/vendor/chunky_png/spec/png_suite/basic/basi0g08.rgba +0 -0
  178. data/vendor/chunky_png/spec/png_suite/basic/basi0g16.png +0 -0
  179. data/vendor/chunky_png/spec/png_suite/basic/basi0g16.rgba +0 -0
  180. data/vendor/chunky_png/spec/png_suite/basic/basi2c08.png +0 -0
  181. data/vendor/chunky_png/spec/png_suite/basic/basi2c08.rgba +0 -0
  182. data/vendor/chunky_png/spec/png_suite/basic/basi2c16.png +0 -0
  183. data/vendor/chunky_png/spec/png_suite/basic/basi2c16.rgba +0 -0
  184. data/vendor/chunky_png/spec/png_suite/basic/basi3p01.png +0 -0
  185. data/vendor/chunky_png/spec/png_suite/basic/basi3p01.rgba +1 -0
  186. data/vendor/chunky_png/spec/png_suite/basic/basi3p02.png +0 -0
  187. data/vendor/chunky_png/spec/png_suite/basic/basi3p02.rgba +0 -0
  188. data/vendor/chunky_png/spec/png_suite/basic/basi3p04.png +0 -0
  189. data/vendor/chunky_png/spec/png_suite/basic/basi3p04.rgba +0 -0
  190. data/vendor/chunky_png/spec/png_suite/basic/basi3p08.png +0 -0
  191. data/vendor/chunky_png/spec/png_suite/basic/basi3p08.rgba +0 -0
  192. data/vendor/chunky_png/spec/png_suite/basic/basi4a08.png +0 -0
  193. data/vendor/chunky_png/spec/png_suite/basic/basi4a08.rgba +0 -0
  194. data/vendor/chunky_png/spec/png_suite/basic/basi4a16.png +0 -0
  195. data/vendor/chunky_png/spec/png_suite/basic/basi4a16.rgba +0 -0
  196. data/vendor/chunky_png/spec/png_suite/basic/basi6a08.png +0 -0
  197. data/vendor/chunky_png/spec/png_suite/basic/basi6a08.rgba +0 -0
  198. data/vendor/chunky_png/spec/png_suite/basic/basi6a16.png +0 -0
  199. data/vendor/chunky_png/spec/png_suite/basic/basi6a16.rgba +0 -0
  200. data/vendor/chunky_png/spec/png_suite/basic/basn0g01.png +0 -0
  201. data/vendor/chunky_png/spec/png_suite/basic/basn0g01.rgba +0 -0
  202. data/vendor/chunky_png/spec/png_suite/basic/basn0g02.png +0 -0
  203. data/vendor/chunky_png/spec/png_suite/basic/basn0g02.rgba +0 -0
  204. data/vendor/chunky_png/spec/png_suite/basic/basn0g04.png +0 -0
  205. data/vendor/chunky_png/spec/png_suite/basic/basn0g04.rgba +0 -0
  206. data/vendor/chunky_png/spec/png_suite/basic/basn0g08.png +0 -0
  207. data/vendor/chunky_png/spec/png_suite/basic/basn0g08.rgba +0 -0
  208. data/vendor/chunky_png/spec/png_suite/basic/basn0g16.png +0 -0
  209. data/vendor/chunky_png/spec/png_suite/basic/basn0g16.rgba +0 -0
  210. data/vendor/chunky_png/spec/png_suite/basic/basn2c08.png +0 -0
  211. data/vendor/chunky_png/spec/png_suite/basic/basn2c08.rgba +0 -0
  212. data/vendor/chunky_png/spec/png_suite/basic/basn2c16.png +0 -0
  213. data/vendor/chunky_png/spec/png_suite/basic/basn2c16.rgba +0 -0
  214. data/vendor/chunky_png/spec/png_suite/basic/basn3p01.png +0 -0
  215. data/vendor/chunky_png/spec/png_suite/basic/basn3p01.rgba +1 -0
  216. data/vendor/chunky_png/spec/png_suite/basic/basn3p02.png +0 -0
  217. data/vendor/chunky_png/spec/png_suite/basic/basn3p02.rgba +0 -0
  218. data/vendor/chunky_png/spec/png_suite/basic/basn3p04.png +0 -0
  219. data/vendor/chunky_png/spec/png_suite/basic/basn3p04.rgba +0 -0
  220. data/vendor/chunky_png/spec/png_suite/basic/basn3p08.png +0 -0
  221. data/vendor/chunky_png/spec/png_suite/basic/basn3p08.rgba +0 -0
  222. data/vendor/chunky_png/spec/png_suite/basic/basn4a08.png +0 -0
  223. data/vendor/chunky_png/spec/png_suite/basic/basn4a08.rgba +0 -0
  224. data/vendor/chunky_png/spec/png_suite/basic/basn4a16.png +0 -0
  225. data/vendor/chunky_png/spec/png_suite/basic/basn4a16.rgba +0 -0
  226. data/vendor/chunky_png/spec/png_suite/basic/basn6a08.png +0 -0
  227. data/vendor/chunky_png/spec/png_suite/basic/basn6a08.rgba +0 -0
  228. data/vendor/chunky_png/spec/png_suite/basic/basn6a16.png +0 -0
  229. data/vendor/chunky_png/spec/png_suite/basic/basn6a16.rgba +0 -0
  230. data/vendor/chunky_png/spec/png_suite/broken/x00n0g01.png +0 -0
  231. data/vendor/chunky_png/spec/png_suite/broken/xcrn0g04.png +0 -0
  232. data/vendor/chunky_png/spec/png_suite/broken/xlfn0g04.png +13 -0
  233. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi1n0g16.png +0 -0
  234. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi1n2c16.png +0 -0
  235. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi2n0g16.png +0 -0
  236. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi2n2c16.png +0 -0
  237. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi4n0g16.png +0 -0
  238. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi4n2c16.png +0 -0
  239. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi9n0g16.png +0 -0
  240. data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi9n2c16.png +0 -0
  241. data/vendor/chunky_png/spec/png_suite/compression_levels/z00n2c08.png +0 -0
  242. data/vendor/chunky_png/spec/png_suite/compression_levels/z03n2c08.png +0 -0
  243. data/vendor/chunky_png/spec/png_suite/compression_levels/z06n2c08.png +0 -0
  244. data/vendor/chunky_png/spec/png_suite/compression_levels/z09n2c08.png +0 -0
  245. data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08.png +0 -0
  246. data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08.rgba +0 -0
  247. data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08_reference.png +0 -0
  248. data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08_reference.rgba +0 -0
  249. data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08.png +0 -0
  250. data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08.rgba +0 -0
  251. data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08_reference.png +0 -0
  252. data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08_reference.rgba +0 -0
  253. data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08.png +0 -0
  254. data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08.rgba +0 -0
  255. data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08_reference.png +0 -0
  256. data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08_reference.rgba +0 -0
  257. data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08.png +0 -0
  258. data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08.rgba +0 -0
  259. data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08_reference.png +0 -0
  260. data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08_reference.rgba +0 -0
  261. data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08.png +0 -0
  262. data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08.rgba +0 -0
  263. data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08_reference.png +0 -0
  264. data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08_reference.rgba +0 -0
  265. data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08.png +0 -0
  266. data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08.rgba +0 -0
  267. data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08_reference.png +0 -0
  268. data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08_reference.rgba +0 -0
  269. data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08.png +0 -0
  270. data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08.rgba +0 -0
  271. data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08_reference.png +0 -0
  272. data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08_reference.rgba +0 -0
  273. data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08.png +0 -0
  274. data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08.rgba +0 -0
  275. data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08_reference.png +0 -0
  276. data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08_reference.rgba +0 -0
  277. data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08.png +0 -0
  278. data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08.rgba +0 -0
  279. data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08_reference.png +0 -0
  280. data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08_reference.rgba +0 -0
  281. data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08.png +0 -0
  282. data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08.rgba +0 -0
  283. data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08_reference.png +0 -0
  284. data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08_reference.rgba +0 -0
  285. data/vendor/chunky_png/spec/png_suite/gamma/g03n0g16.png +0 -0
  286. data/vendor/chunky_png/spec/png_suite/gamma/g03n2c08.png +0 -0
  287. data/vendor/chunky_png/spec/png_suite/gamma/g03n3p04.png +0 -0
  288. data/vendor/chunky_png/spec/png_suite/gamma/g04n0g16.png +0 -0
  289. data/vendor/chunky_png/spec/png_suite/gamma/g04n2c08.png +0 -0
  290. data/vendor/chunky_png/spec/png_suite/gamma/g04n3p04.png +0 -0
  291. data/vendor/chunky_png/spec/png_suite/gamma/g05n0g16.png +0 -0
  292. data/vendor/chunky_png/spec/png_suite/gamma/g05n2c08.png +0 -0
  293. data/vendor/chunky_png/spec/png_suite/gamma/g05n3p04.png +0 -0
  294. data/vendor/chunky_png/spec/png_suite/gamma/g07n0g16.png +0 -0
  295. data/vendor/chunky_png/spec/png_suite/gamma/g07n2c08.png +0 -0
  296. data/vendor/chunky_png/spec/png_suite/gamma/g07n3p04.png +0 -0
  297. data/vendor/chunky_png/spec/png_suite/gamma/g10n0g16.png +0 -0
  298. data/vendor/chunky_png/spec/png_suite/gamma/g10n2c08.png +0 -0
  299. data/vendor/chunky_png/spec/png_suite/gamma/g10n3p04.png +0 -0
  300. data/vendor/chunky_png/spec/png_suite/gamma/g25n0g16.png +0 -0
  301. data/vendor/chunky_png/spec/png_suite/gamma/g25n2c08.png +0 -0
  302. data/vendor/chunky_png/spec/png_suite/gamma/g25n3p04.png +0 -0
  303. data/vendor/chunky_png/spec/png_suite/metadata/cm0n0g04.png +0 -0
  304. data/vendor/chunky_png/spec/png_suite/metadata/cm7n0g04.png +0 -0
  305. data/vendor/chunky_png/spec/png_suite/metadata/cm9n0g04.png +0 -0
  306. data/vendor/chunky_png/spec/png_suite/other/ccwn2c08.png +0 -0
  307. data/vendor/chunky_png/spec/png_suite/other/ccwn3p08.png +0 -0
  308. data/vendor/chunky_png/spec/png_suite/other/cdfn2c08.png +0 -0
  309. data/vendor/chunky_png/spec/png_suite/other/cdhn2c08.png +0 -0
  310. data/vendor/chunky_png/spec/png_suite/other/cdsn2c08.png +0 -0
  311. data/vendor/chunky_png/spec/png_suite/other/cdun2c08.png +0 -0
  312. data/vendor/chunky_png/spec/png_suite/other/ch1n3p04.png +0 -0
  313. data/vendor/chunky_png/spec/png_suite/other/ch2n3p08.png +0 -0
  314. data/vendor/chunky_png/spec/png_suite/other/cs3n2c16.png +0 -0
  315. data/vendor/chunky_png/spec/png_suite/other/cs3n3p08.png +0 -0
  316. data/vendor/chunky_png/spec/png_suite/other/cs5n2c08.png +0 -0
  317. data/vendor/chunky_png/spec/png_suite/other/cs5n3p08.png +0 -0
  318. data/vendor/chunky_png/spec/png_suite/other/cs8n2c08.png +0 -0
  319. data/vendor/chunky_png/spec/png_suite/other/cs8n3p08.png +0 -0
  320. data/vendor/chunky_png/spec/png_suite/other/ct0n0g04.png +0 -0
  321. data/vendor/chunky_png/spec/png_suite/other/ct1n0g04.png +0 -0
  322. data/vendor/chunky_png/spec/png_suite/other/ctzn0g04.png +0 -0
  323. data/vendor/chunky_png/spec/png_suite/other/pp0n2c16.png +0 -0
  324. data/vendor/chunky_png/spec/png_suite/other/pp0n6a08.png +0 -0
  325. data/vendor/chunky_png/spec/png_suite/other/ps1n0g08.png +0 -0
  326. data/vendor/chunky_png/spec/png_suite/other/ps1n2c16.png +0 -0
  327. data/vendor/chunky_png/spec/png_suite/other/ps2n0g08.png +0 -0
  328. data/vendor/chunky_png/spec/png_suite/other/ps2n2c16.png +0 -0
  329. data/vendor/chunky_png/spec/png_suite/sizes/s01i3p01.png +0 -0
  330. data/vendor/chunky_png/spec/png_suite/sizes/s01n3p01.png +0 -0
  331. data/vendor/chunky_png/spec/png_suite/sizes/s02i3p01.png +0 -0
  332. data/vendor/chunky_png/spec/png_suite/sizes/s02n3p01.png +0 -0
  333. data/vendor/chunky_png/spec/png_suite/sizes/s03i3p01.png +0 -0
  334. data/vendor/chunky_png/spec/png_suite/sizes/s03n3p01.png +0 -0
  335. data/vendor/chunky_png/spec/png_suite/sizes/s04i3p01.png +0 -0
  336. data/vendor/chunky_png/spec/png_suite/sizes/s04n3p01.png +0 -0
  337. data/vendor/chunky_png/spec/png_suite/sizes/s05i3p02.png +0 -0
  338. data/vendor/chunky_png/spec/png_suite/sizes/s05n3p02.png +0 -0
  339. data/vendor/chunky_png/spec/png_suite/sizes/s06i3p02.png +0 -0
  340. data/vendor/chunky_png/spec/png_suite/sizes/s06n3p02.png +0 -0
  341. data/vendor/chunky_png/spec/png_suite/sizes/s07i3p02.png +0 -0
  342. data/vendor/chunky_png/spec/png_suite/sizes/s07n3p02.png +0 -0
  343. data/vendor/chunky_png/spec/png_suite/sizes/s08i3p02.png +0 -0
  344. data/vendor/chunky_png/spec/png_suite/sizes/s08n3p02.png +0 -0
  345. data/vendor/chunky_png/spec/png_suite/sizes/s09i3p02.png +0 -0
  346. data/vendor/chunky_png/spec/png_suite/sizes/s09n3p02.png +0 -0
  347. data/vendor/chunky_png/spec/png_suite/sizes/s32i3p04.png +0 -0
  348. data/vendor/chunky_png/spec/png_suite/sizes/s32n3p04.png +0 -0
  349. data/vendor/chunky_png/spec/png_suite/sizes/s33i3p04.png +0 -0
  350. data/vendor/chunky_png/spec/png_suite/sizes/s33n3p04.png +0 -0
  351. data/vendor/chunky_png/spec/png_suite/sizes/s34i3p04.png +0 -0
  352. data/vendor/chunky_png/spec/png_suite/sizes/s34n3p04.png +0 -0
  353. data/vendor/chunky_png/spec/png_suite/sizes/s35i3p04.png +0 -0
  354. data/vendor/chunky_png/spec/png_suite/sizes/s35n3p04.png +0 -0
  355. data/vendor/chunky_png/spec/png_suite/sizes/s36i3p04.png +0 -0
  356. data/vendor/chunky_png/spec/png_suite/sizes/s36n3p04.png +0 -0
  357. data/vendor/chunky_png/spec/png_suite/sizes/s37i3p04.png +0 -0
  358. data/vendor/chunky_png/spec/png_suite/sizes/s37n3p04.png +0 -0
  359. data/vendor/chunky_png/spec/png_suite/sizes/s38i3p04.png +0 -0
  360. data/vendor/chunky_png/spec/png_suite/sizes/s38n3p04.png +0 -0
  361. data/vendor/chunky_png/spec/png_suite/sizes/s39i3p04.png +0 -0
  362. data/vendor/chunky_png/spec/png_suite/sizes/s39n3p04.png +0 -0
  363. data/vendor/chunky_png/spec/png_suite/sizes/s40i3p04.png +0 -0
  364. data/vendor/chunky_png/spec/png_suite/sizes/s40n3p04.png +0 -0
  365. data/vendor/chunky_png/spec/png_suite/transparency/tbbn1g04.png +0 -0
  366. data/vendor/chunky_png/spec/png_suite/transparency/tbbn2c16.png +0 -0
  367. data/vendor/chunky_png/spec/png_suite/transparency/tbbn3p08.png +0 -0
  368. data/vendor/chunky_png/spec/png_suite/transparency/tbgn2c16.png +0 -0
  369. data/vendor/chunky_png/spec/png_suite/transparency/tbgn3p08.png +0 -0
  370. data/vendor/chunky_png/spec/png_suite/transparency/tbrn2c08.png +0 -0
  371. data/vendor/chunky_png/spec/png_suite/transparency/tbwn1g16.png +0 -0
  372. data/vendor/chunky_png/spec/png_suite/transparency/tbwn3p08.png +0 -0
  373. data/vendor/chunky_png/spec/png_suite/transparency/tbyn3p08.png +0 -0
  374. data/vendor/chunky_png/spec/png_suite/transparency/tp0n1g08.png +0 -0
  375. data/vendor/chunky_png/spec/png_suite/transparency/tp0n2c08.png +0 -0
  376. data/vendor/chunky_png/spec/png_suite/transparency/tp0n3p08.png +0 -0
  377. data/vendor/chunky_png/spec/png_suite/transparency/tp1n3p08.png +0 -0
  378. data/vendor/chunky_png/spec/png_suite_spec.rb +121 -0
  379. data/vendor/chunky_png/spec/resources/adam7.png +0 -0
  380. data/vendor/chunky_png/spec/resources/bezier_five_point.png +0 -0
  381. data/vendor/chunky_png/spec/resources/bezier_four_point.png +0 -0
  382. data/vendor/chunky_png/spec/resources/bezier_four_point_flipped.png +0 -0
  383. data/vendor/chunky_png/spec/resources/bezier_four_point_s.png +0 -0
  384. data/vendor/chunky_png/spec/resources/bezier_six_point.png +0 -0
  385. data/vendor/chunky_png/spec/resources/bezier_three_point.png +0 -0
  386. data/vendor/chunky_png/spec/resources/bezier_three_point_flipped.png +0 -0
  387. data/vendor/chunky_png/spec/resources/circles.png +0 -0
  388. data/vendor/chunky_png/spec/resources/clock.png +0 -0
  389. data/vendor/chunky_png/spec/resources/clock_base.png +0 -0
  390. data/vendor/chunky_png/spec/resources/clock_bl_xdown_ydown.png +0 -0
  391. data/vendor/chunky_png/spec/resources/clock_bl_xdown_yup.png +0 -0
  392. data/vendor/chunky_png/spec/resources/clock_bl_xup_yup.png +0 -0
  393. data/vendor/chunky_png/spec/resources/clock_mask.png +0 -0
  394. data/vendor/chunky_png/spec/resources/clock_mask_updated.png +0 -0
  395. data/vendor/chunky_png/spec/resources/clock_nn_xdown_ydown.png +0 -0
  396. data/vendor/chunky_png/spec/resources/clock_nn_xdown_yup.png +0 -0
  397. data/vendor/chunky_png/spec/resources/clock_nn_xup_yup.png +0 -0
  398. data/vendor/chunky_png/spec/resources/clock_updated.png +0 -0
  399. data/vendor/chunky_png/spec/resources/composited.png +0 -0
  400. data/vendor/chunky_png/spec/resources/cropped.png +0 -0
  401. data/vendor/chunky_png/spec/resources/damaged_chunk.png +0 -0
  402. data/vendor/chunky_png/spec/resources/damaged_signature.png +13 -0
  403. data/vendor/chunky_png/spec/resources/lines.png +0 -0
  404. data/vendor/chunky_png/spec/resources/operations.png +0 -0
  405. data/vendor/chunky_png/spec/resources/operations_border.png +0 -0
  406. data/vendor/chunky_png/spec/resources/operations_grayscale.png +0 -0
  407. data/vendor/chunky_png/spec/resources/partial_circles.png +0 -0
  408. data/vendor/chunky_png/spec/resources/pixelstream.bgr +67 -0
  409. data/vendor/chunky_png/spec/resources/pixelstream.rgb +67 -1
  410. data/vendor/chunky_png/spec/resources/pixelstream.rgba +67 -0
  411. data/vendor/chunky_png/spec/resources/pixelstream_best_compression.png +0 -0
  412. data/vendor/chunky_png/spec/resources/pixelstream_fast_rgba.png +0 -0
  413. data/vendor/chunky_png/spec/resources/pixelstream_reference.png +0 -0
  414. data/vendor/chunky_png/spec/resources/polygon_filled_horizontal.png +0 -0
  415. data/vendor/chunky_png/spec/resources/polygon_filled_vertical.png +0 -0
  416. data/vendor/chunky_png/spec/resources/polygon_triangle_filled.png +0 -0
  417. data/vendor/chunky_png/spec/resources/polygon_unfilled.png +0 -0
  418. data/vendor/chunky_png/spec/resources/rect.png +0 -0
  419. data/vendor/chunky_png/spec/resources/replaced.png +0 -0
  420. data/vendor/chunky_png/spec/resources/text_chunk.png +0 -0
  421. data/vendor/chunky_png/spec/resources/ztxt_chunk.png +0 -0
  422. data/vendor/chunky_png/spec/spec_helper.rb +52 -0
  423. data/vendor/chunky_png/tasks/benchmarks.rake +26 -0
  424. data/vendor/oily_png/Gemfile +4 -0
  425. data/vendor/oily_png/LICENSE +20 -0
  426. data/vendor/oily_png/README.rdoc +26 -0
  427. data/vendor/oily_png/Rakefile +19 -0
  428. data/vendor/oily_png/ext/oily_png/color.c +58 -0
  429. data/vendor/oily_png/ext/oily_png/color.h +29 -0
  430. data/vendor/oily_png/ext/oily_png/extconf.rb +3 -0
  431. data/vendor/oily_png/ext/oily_png/oily_png_ext.c +59 -0
  432. data/vendor/oily_png/ext/oily_png/oily_png_ext.h +72 -0
  433. data/vendor/oily_png/ext/oily_png/operations.c +122 -0
  434. data/vendor/oily_png/ext/oily_png/operations.h +36 -0
  435. data/vendor/oily_png/ext/oily_png/png_decoding.c +374 -0
  436. data/vendor/oily_png/ext/oily_png/png_decoding.h +27 -0
  437. data/vendor/oily_png/ext/oily_png/png_encoding.c +302 -0
  438. data/vendor/oily_png/ext/oily_png/png_encoding.h +19 -0
  439. data/vendor/oily_png/ext/oily_png/resampling.c +213 -0
  440. data/vendor/oily_png/ext/oily_png/resampling.h +25 -0
  441. data/vendor/oily_png/lib/oily_png.rb +21 -0
  442. data/vendor/oily_png/lib/oily_png/canvas.rb +15 -0
  443. data/vendor/oily_png/lib/oily_png/version.rb +3 -0
  444. data/vendor/oily_png/oily_png.gemspec +39 -0
  445. data/vendor/oily_png/spec/color_spec.rb +38 -0
  446. data/vendor/oily_png/spec/decoding_spec.rb +51 -0
  447. data/vendor/oily_png/spec/encoding_spec.rb +135 -0
  448. data/vendor/oily_png/spec/operations_spec.rb +52 -0
  449. data/vendor/oily_png/spec/resampling_spec.rb +51 -0
  450. data/vendor/oily_png/spec/resources/basi0g01.png +0 -0
  451. data/vendor/oily_png/spec/resources/basi0g02.png +0 -0
  452. data/vendor/oily_png/spec/resources/basi0g04.png +0 -0
  453. data/vendor/oily_png/spec/resources/basi0g08.png +0 -0
  454. data/vendor/oily_png/spec/resources/basi0g16.png +0 -0
  455. data/vendor/oily_png/spec/resources/basi2c08.png +0 -0
  456. data/vendor/oily_png/spec/resources/basi2c16.png +0 -0
  457. data/vendor/oily_png/spec/resources/basi3p01.png +0 -0
  458. data/vendor/oily_png/spec/resources/basi3p02.png +0 -0
  459. data/vendor/oily_png/spec/resources/basi3p04.png +0 -0
  460. data/vendor/oily_png/spec/resources/basi3p08.png +0 -0
  461. data/vendor/oily_png/spec/resources/basi4a08.png +0 -0
  462. data/vendor/oily_png/spec/resources/basi4a16.png +0 -0
  463. data/vendor/oily_png/spec/resources/basi6a08.png +0 -0
  464. data/vendor/oily_png/spec/resources/basi6a16.png +0 -0
  465. data/vendor/oily_png/spec/resources/basn0g01.png +0 -0
  466. data/vendor/oily_png/spec/resources/basn0g02.png +0 -0
  467. data/vendor/oily_png/spec/resources/basn0g04.png +0 -0
  468. data/vendor/oily_png/spec/resources/basn0g08.png +0 -0
  469. data/vendor/oily_png/spec/resources/basn0g16.png +0 -0
  470. data/vendor/oily_png/spec/resources/basn2c08.png +0 -0
  471. data/vendor/oily_png/spec/resources/basn2c16.png +0 -0
  472. data/vendor/oily_png/spec/resources/basn3p01.png +0 -0
  473. data/vendor/oily_png/spec/resources/basn3p02.png +0 -0
  474. data/vendor/oily_png/spec/resources/basn3p04.png +0 -0
  475. data/vendor/oily_png/spec/resources/basn3p08.png +0 -0
  476. data/vendor/oily_png/spec/resources/basn4a08.png +0 -0
  477. data/vendor/oily_png/spec/resources/basn4a16.png +0 -0
  478. data/vendor/oily_png/spec/resources/basn6a08.png +0 -0
  479. data/vendor/oily_png/spec/resources/basn6a16.png +0 -0
  480. data/vendor/oily_png/spec/resources/composited.png +0 -0
  481. data/vendor/oily_png/spec/resources/gray.png +0 -0
  482. data/vendor/oily_png/spec/resources/interlaced.png +0 -0
  483. data/vendor/oily_png/spec/resources/nonsquare.png +0 -0
  484. data/vendor/oily_png/spec/resources/operations.png +0 -0
  485. data/vendor/oily_png/spec/resources/replaced.png +0 -0
  486. data/vendor/oily_png/spec/resources/s01i3p01.png +0 -0
  487. data/vendor/oily_png/spec/resources/s01n3p01.png +0 -0
  488. data/vendor/oily_png/spec/resources/s02i3p01.png +0 -0
  489. data/vendor/oily_png/spec/resources/s02n3p01.png +0 -0
  490. data/vendor/oily_png/spec/resources/s03i3p01.png +0 -0
  491. data/vendor/oily_png/spec/resources/s03n3p01.png +0 -0
  492. data/vendor/oily_png/spec/resources/s04i3p01.png +0 -0
  493. data/vendor/oily_png/spec/resources/s04n3p01.png +0 -0
  494. data/vendor/oily_png/spec/resources/s05i3p02.png +0 -0
  495. data/vendor/oily_png/spec/resources/s05n3p02.png +0 -0
  496. data/vendor/oily_png/spec/resources/s06i3p02.png +0 -0
  497. data/vendor/oily_png/spec/resources/s06n3p02.png +0 -0
  498. data/vendor/oily_png/spec/resources/s07i3p02.png +0 -0
  499. data/vendor/oily_png/spec/resources/s07n3p02.png +0 -0
  500. data/vendor/oily_png/spec/resources/s08i3p02.png +0 -0
  501. data/vendor/oily_png/spec/resources/s08n3p02.png +0 -0
  502. data/vendor/oily_png/spec/resources/s09i3p02.png +0 -0
  503. data/vendor/oily_png/spec/resources/s09n3p02.png +0 -0
  504. data/vendor/oily_png/spec/resources/s32i3p04.png +0 -0
  505. data/vendor/oily_png/spec/resources/s32n3p04.png +0 -0
  506. data/vendor/oily_png/spec/resources/s33i3p04.png +0 -0
  507. data/vendor/oily_png/spec/resources/s33n3p04.png +0 -0
  508. data/vendor/oily_png/spec/resources/s34i3p04.png +0 -0
  509. data/vendor/oily_png/spec/resources/s34n3p04.png +0 -0
  510. data/vendor/oily_png/spec/resources/s35i3p04.png +0 -0
  511. data/vendor/oily_png/spec/resources/s35n3p04.png +0 -0
  512. data/vendor/oily_png/spec/resources/s36i3p04.png +0 -0
  513. data/vendor/oily_png/spec/resources/s36n3p04.png +0 -0
  514. data/vendor/oily_png/spec/resources/s37i3p04.png +0 -0
  515. data/vendor/oily_png/spec/resources/s37n3p04.png +0 -0
  516. data/vendor/oily_png/spec/resources/s38i3p04.png +0 -0
  517. data/vendor/oily_png/spec/resources/s38n3p04.png +0 -0
  518. data/vendor/oily_png/spec/resources/s39i3p04.png +0 -0
  519. data/vendor/oily_png/spec/resources/s39n3p04.png +0 -0
  520. data/vendor/oily_png/spec/resources/s40i3p04.png +0 -0
  521. data/vendor/oily_png/spec/resources/s40n3p04.png +0 -0
  522. data/vendor/oily_png/spec/resources/square.png +0 -0
  523. data/vendor/oily_png/spec/resources/tbbn1g04.png +0 -0
  524. data/vendor/oily_png/spec/resources/tbbn2c16.png +0 -0
  525. data/vendor/oily_png/spec/resources/tbbn3p08.png +0 -0
  526. data/vendor/oily_png/spec/resources/tbgn2c16.png +0 -0
  527. data/vendor/oily_png/spec/resources/tbgn3p08.png +0 -0
  528. data/vendor/oily_png/spec/resources/tbrn2c08.png +0 -0
  529. data/vendor/oily_png/spec/resources/tbwn1g16.png +0 -0
  530. data/vendor/oily_png/spec/resources/tbwn3p08.png +0 -0
  531. data/vendor/oily_png/spec/resources/tbyn3p08.png +0 -0
  532. data/vendor/oily_png/spec/resources/tp0n1g08.png +0 -0
  533. data/vendor/oily_png/spec/resources/tp0n2c08.png +0 -0
  534. data/vendor/oily_png/spec/resources/tp0n3p08.png +0 -0
  535. data/vendor/oily_png/spec/resources/tp1n3p08.png +0 -0
  536. data/vendor/oily_png/spec/spec_helper.rb +40 -0
  537. data/vendor/oily_png/tasks/testing.rake +49 -0
  538. data/vendor/psd.rb/CONTRIBUTING.md +7 -0
  539. data/vendor/psd.rb/Gemfile +2 -0
  540. data/vendor/psd.rb/Guardfile +8 -0
  541. data/vendor/psd.rb/LICENSE.txt +22 -0
  542. data/vendor/psd.rb/README.md +235 -0
  543. data/vendor/psd.rb/Rakefile +6 -0
  544. data/vendor/psd.rb/circle.yml +6 -0
  545. data/vendor/psd.rb/examples/build_image.rb +16 -0
  546. data/vendor/psd.rb/examples/export_image.rb +12 -0
  547. data/vendor/psd.rb/examples/export_layer_images.rb +19 -0
  548. data/vendor/psd.rb/examples/export_node.rb +7 -0
  549. data/vendor/psd.rb/examples/export_text_data.rb +13 -0
  550. data/vendor/psd.rb/examples/guides.rb +17 -0
  551. data/vendor/psd.rb/examples/images/comp-example.psd +0 -0
  552. data/vendor/psd.rb/examples/images/example-cmyk.psd +0 -0
  553. data/vendor/psd.rb/examples/images/example-greyscale.psd +0 -0
  554. data/vendor/psd.rb/examples/images/example-nocompat.psd +0 -0
  555. data/vendor/psd.rb/examples/images/example.psd +0 -0
  556. data/vendor/psd.rb/examples/images/example16.psd +0 -0
  557. data/vendor/psd.rb/examples/images/guides.psd +0 -0
  558. data/vendor/psd.rb/examples/layer_comps.rb +20 -0
  559. data/vendor/psd.rb/examples/parse.rb +36 -0
  560. data/vendor/psd.rb/examples/path.rb +7 -0
  561. data/vendor/psd.rb/examples/profile.rb +15 -0
  562. data/vendor/psd.rb/examples/slices.rb +17 -0
  563. data/vendor/psd.rb/examples/tree.rb +8 -0
  564. data/vendor/psd.rb/examples/unimplemented_info.rb +9 -0
  565. data/vendor/psd.rb/lib/psd.rb +173 -0
  566. data/vendor/psd.rb/lib/psd/blend_mode.rb +80 -0
  567. data/vendor/psd.rb/lib/psd/channel_image.rb +115 -0
  568. data/vendor/psd.rb/lib/psd/color.rb +125 -0
  569. data/vendor/psd.rb/lib/psd/descriptor.rb +200 -0
  570. data/vendor/psd.rb/lib/psd/file.rb +104 -0
  571. data/vendor/psd.rb/lib/psd/header.rb +69 -0
  572. data/vendor/psd.rb/lib/psd/helpers.rb +51 -0
  573. data/vendor/psd.rb/lib/psd/image.rb +123 -0
  574. data/vendor/psd.rb/lib/psd/image_exports/png.rb +31 -0
  575. data/vendor/psd.rb/lib/psd/image_formats/layer_raw.rb +21 -0
  576. data/vendor/psd.rb/lib/psd/image_formats/layer_rle.rb +24 -0
  577. data/vendor/psd.rb/lib/psd/image_formats/raw.rb +12 -0
  578. data/vendor/psd.rb/lib/psd/image_formats/rle.rb +63 -0
  579. data/vendor/psd.rb/lib/psd/image_modes/cmyk.rb +31 -0
  580. data/vendor/psd.rb/lib/psd/image_modes/greyscale.rb +22 -0
  581. data/vendor/psd.rb/lib/psd/image_modes/rgb.rb +32 -0
  582. data/vendor/psd.rb/lib/psd/layer.rb +77 -0
  583. data/vendor/psd.rb/lib/psd/layer/blend_modes.rb +30 -0
  584. data/vendor/psd.rb/lib/psd/layer/blending_ranges.rb +62 -0
  585. data/vendor/psd.rb/lib/psd/layer/channel_image.rb +15 -0
  586. data/vendor/psd.rb/lib/psd/layer/exporting.rb +28 -0
  587. data/vendor/psd.rb/lib/psd/layer/helpers.rb +77 -0
  588. data/vendor/psd.rb/lib/psd/layer/info.rb +74 -0
  589. data/vendor/psd.rb/lib/psd/layer/mask.rb +19 -0
  590. data/vendor/psd.rb/lib/psd/layer/name.rb +33 -0
  591. data/vendor/psd.rb/lib/psd/layer/path_components.rb +22 -0
  592. data/vendor/psd.rb/lib/psd/layer/position_and_channels.rb +47 -0
  593. data/vendor/psd.rb/lib/psd/layer_info.rb +27 -0
  594. data/vendor/psd.rb/lib/psd/layer_info/blend_clipping_elements.rb +13 -0
  595. data/vendor/psd.rb/lib/psd/layer_info/blend_interior_elements.rb +13 -0
  596. data/vendor/psd.rb/lib/psd/layer_info/fill_opacity.rb +13 -0
  597. data/vendor/psd.rb/lib/psd/layer_info/layer_group.rb +30 -0
  598. data/vendor/psd.rb/lib/psd/layer_info/layer_id.rb +13 -0
  599. data/vendor/psd.rb/lib/psd/layer_info/layer_name_source.rb +14 -0
  600. data/vendor/psd.rb/lib/psd/layer_info/layer_section_divider.rb +48 -0
  601. data/vendor/psd.rb/lib/psd/layer_info/legacy_typetool.rb +88 -0
  602. data/vendor/psd.rb/lib/psd/layer_info/locked.rb +19 -0
  603. data/vendor/psd.rb/lib/psd/layer_info/metadata_setting.rb +35 -0
  604. data/vendor/psd.rb/lib/psd/layer_info/object_effects.rb +16 -0
  605. data/vendor/psd.rb/lib/psd/layer_info/placed_layer.rb +13 -0
  606. data/vendor/psd.rb/lib/psd/layer_info/reference_point.rb +16 -0
  607. data/vendor/psd.rb/lib/psd/layer_info/typetool.rb +165 -0
  608. data/vendor/psd.rb/lib/psd/layer_info/unicode_name.rb +17 -0
  609. data/vendor/psd.rb/lib/psd/layer_info/vector_mask.rb +25 -0
  610. data/vendor/psd.rb/lib/psd/layer_info/vector_mask_2.rb +10 -0
  611. data/vendor/psd.rb/lib/psd/layer_info/vector_stroke.rb +12 -0
  612. data/vendor/psd.rb/lib/psd/layer_info/vector_stroke_content.rb +15 -0
  613. data/vendor/psd.rb/lib/psd/layer_mask.rb +129 -0
  614. data/vendor/psd.rb/lib/psd/lazy_execute.rb +60 -0
  615. data/vendor/psd.rb/lib/psd/logger.rb +40 -0
  616. data/vendor/psd.rb/lib/psd/mask.rb +74 -0
  617. data/vendor/psd.rb/lib/psd/node.rb +70 -0
  618. data/vendor/psd.rb/lib/psd/node_exporting.rb +20 -0
  619. data/vendor/psd.rb/lib/psd/node_group.rb +86 -0
  620. data/vendor/psd.rb/lib/psd/node_layer.rb +81 -0
  621. data/vendor/psd.rb/lib/psd/node_root.rb +93 -0
  622. data/vendor/psd.rb/lib/psd/nodes/ancestry.rb +98 -0
  623. data/vendor/psd.rb/lib/psd/nodes/build_preview.rb +17 -0
  624. data/vendor/psd.rb/lib/psd/nodes/has_children.rb +13 -0
  625. data/vendor/psd.rb/lib/psd/nodes/lock_to_origin.rb +7 -0
  626. data/vendor/psd.rb/lib/psd/nodes/parse_layers.rb +18 -0
  627. data/vendor/psd.rb/lib/psd/nodes/search.rb +91 -0
  628. data/vendor/psd.rb/lib/psd/path_record.rb +180 -0
  629. data/vendor/psd.rb/lib/psd/renderer.rb +91 -0
  630. data/vendor/psd.rb/lib/psd/renderer/blender.rb +53 -0
  631. data/vendor/psd.rb/lib/psd/renderer/canvas.rb +95 -0
  632. data/vendor/psd.rb/lib/psd/renderer/canvas_management.rb +26 -0
  633. data/vendor/psd.rb/lib/psd/renderer/clipping_mask.rb +41 -0
  634. data/vendor/psd.rb/lib/psd/renderer/compose.rb +361 -0
  635. data/vendor/psd.rb/lib/psd/renderer/layer_styles.rb +56 -0
  636. data/vendor/psd.rb/lib/psd/renderer/layer_styles/color_overlay.rb +65 -0
  637. data/vendor/psd.rb/lib/psd/renderer/layer_styles/drop_shadow.rb +75 -0
  638. data/vendor/psd.rb/lib/psd/renderer/mask.rb +46 -0
  639. data/vendor/psd.rb/lib/psd/resource.rb +26 -0
  640. data/vendor/psd.rb/lib/psd/resource_section.rb +22 -0
  641. data/vendor/psd.rb/lib/psd/resources.rb +69 -0
  642. data/vendor/psd.rb/lib/psd/resources/guides.rb +35 -0
  643. data/vendor/psd.rb/lib/psd/resources/layer_comps.rb +42 -0
  644. data/vendor/psd.rb/lib/psd/resources/slices.rb +132 -0
  645. data/vendor/psd.rb/lib/psd/section.rb +26 -0
  646. data/vendor/psd.rb/lib/psd/util.rb +18 -0
  647. data/vendor/psd.rb/lib/psd/version.rb +3 -0
  648. data/vendor/psd.rb/psd.gemspec +32 -0
  649. data/vendor/psd.rb/spec/files/blendmodes.psd +0 -0
  650. data/vendor/psd.rb/spec/files/empty-layer-subgroups.psd +0 -0
  651. data/vendor/psd.rb/spec/files/empty-layer.psd +0 -0
  652. data/vendor/psd.rb/spec/files/example.psd +0 -0
  653. data/vendor/psd.rb/spec/files/guides.psd +0 -0
  654. data/vendor/psd.rb/spec/files/locked.psd +0 -0
  655. data/vendor/psd.rb/spec/files/one_layer.psd +0 -0
  656. data/vendor/psd.rb/spec/files/path.psd +0 -0
  657. data/vendor/psd.rb/spec/files/pixel.psd +0 -0
  658. data/vendor/psd.rb/spec/files/simplest.psd +0 -0
  659. data/vendor/psd.rb/spec/files/slices.psd +0 -0
  660. data/vendor/psd.rb/spec/files/text.psd +0 -0
  661. data/vendor/psd.rb/spec/guides_spec.rb +34 -0
  662. data/vendor/psd.rb/spec/hierarchy_spec.rb +152 -0
  663. data/vendor/psd.rb/spec/image_spec.rb +86 -0
  664. data/vendor/psd.rb/spec/lazy_execute_spec.rb +20 -0
  665. data/vendor/psd.rb/spec/locked_spec.rb +78 -0
  666. data/vendor/psd.rb/spec/parsing_spec.rb +163 -0
  667. data/vendor/psd.rb/spec/psd_spec.rb +37 -0
  668. data/vendor/psd.rb/spec/slices_spec.rb +57 -0
  669. data/vendor/psd.rb/spec/spec_helper.rb +13 -0
  670. data/vendor/psd.rb/spec/text_spec.rb +27 -0
  671. data/vendor/psd_native/Gemfile +4 -0
  672. data/vendor/psd_native/Guardfile +6 -0
  673. data/vendor/psd_native/LICENSE.txt +22 -0
  674. data/vendor/psd_native/README.md +48 -0
  675. data/vendor/psd_native/Rakefile +13 -0
  676. data/vendor/psd_native/ext/psd_native/blender.c +57 -0
  677. data/vendor/psd_native/ext/psd_native/blender.h +6 -0
  678. data/vendor/psd_native/ext/psd_native/canvas.c +9 -0
  679. data/vendor/psd_native/ext/psd_native/canvas.h +6 -0
  680. data/vendor/psd_native/ext/psd_native/clipping_mask.c +57 -0
  681. data/vendor/psd_native/ext/psd_native/clipping_mask.h +6 -0
  682. data/vendor/psd_native/ext/psd_native/color.c +20 -0
  683. data/vendor/psd_native/ext/psd_native/color.h +18 -0
  684. data/vendor/psd_native/ext/psd_native/compose.c +394 -0
  685. data/vendor/psd_native/ext/psd_native/compose.h +43 -0
  686. data/vendor/psd_native/ext/psd_native/extconf.rb +3 -0
  687. data/vendor/psd_native/ext/psd_native/file.c +20 -0
  688. data/vendor/psd_native/ext/psd_native/file.h +9 -0
  689. data/vendor/psd_native/ext/psd_native/image_mode_cmyk.c +64 -0
  690. data/vendor/psd_native/ext/psd_native/image_mode_cmyk.h +6 -0
  691. data/vendor/psd_native/ext/psd_native/image_mode_greyscale.c +27 -0
  692. data/vendor/psd_native/ext/psd_native/image_mode_greyscale.h +6 -0
  693. data/vendor/psd_native/ext/psd_native/image_mode_rgb.c +49 -0
  694. data/vendor/psd_native/ext/psd_native/image_mode_rgb.h +6 -0
  695. data/vendor/psd_native/ext/psd_native/layer_raw.c +20 -0
  696. data/vendor/psd_native/ext/psd_native/layer_raw.h +6 -0
  697. data/vendor/psd_native/ext/psd_native/mask.c +52 -0
  698. data/vendor/psd_native/ext/psd_native/mask.h +6 -0
  699. data/vendor/psd_native/ext/psd_native/psd_native_ext.c +87 -0
  700. data/vendor/psd_native/ext/psd_native/psd_native_ext.h +31 -0
  701. data/vendor/psd_native/ext/psd_native/rle_decoding.c +53 -0
  702. data/vendor/psd_native/ext/psd_native/rle_decoding.h +6 -0
  703. data/vendor/psd_native/ext/psd_native/util.c +17 -0
  704. data/vendor/psd_native/ext/psd_native/util.h +8 -0
  705. data/vendor/psd_native/lib/psd_native.rb +35 -0
  706. data/vendor/psd_native/lib/psd_native/compose.rb +19 -0
  707. data/vendor/psd_native/lib/psd_native/version.rb +3 -0
  708. data/vendor/psd_native/psd_native.gemspec +35 -0
  709. data/vendor/psd_native/spec/files/example.psd +0 -0
  710. data/vendor/psd_native/spec/files/one_layer.psd +0 -0
  711. data/vendor/psd_native/spec/files/path.psd +0 -0
  712. data/vendor/psd_native/spec/files/pixel.psd +0 -0
  713. data/vendor/psd_native/spec/files/simplest.psd +0 -0
  714. data/vendor/psd_native/spec/files/text.psd +0 -0
  715. data/vendor/psd_native/spec/image_spec.rb +86 -0
  716. data/vendor/psd_native/spec/psd_spec.rb +37 -0
  717. data/vendor/psd_native/spec/spec_helper.rb +13 -0
  718. data/vendor/psd_native/spec/util_spec.rb +15 -0
  719. metadata +767 -0
@@ -0,0 +1,17 @@
1
+ def micro_harness_input
2
+ [1, 2, 3, 4, 5, 6, 7, 8]
3
+ end
4
+
5
+ def micro_harness_iterations
6
+ 1_000_000
7
+ end
8
+
9
+ def micro_harness_sample(input)
10
+ input.pack('CSLQcslq').sum
11
+ end
12
+
13
+ def micro_harness_expected
14
+ 36
15
+ end
16
+
17
+ require 'bench9000/micro-harness'
@@ -0,0 +1,28 @@
1
+ def micro_harness_input
2
+ s = "abcdefghij" * 1_000_000
3
+ t = s.dup
4
+
5
+ # Ensure to unshare the underlying buffers
6
+ t[0] = 'z'
7
+ t[0] = 'a'
8
+
9
+ [s, t]
10
+ end
11
+
12
+ def micro_harness_iterations
13
+ 100
14
+ end
15
+
16
+ def micro_harness_sample(input)
17
+ s = input[0]
18
+ t = input[1]
19
+
20
+ r = s == t
21
+ r ? 1 : 0
22
+ end
23
+
24
+ def micro_harness_expected
25
+ 1
26
+ end
27
+
28
+ require 'bench9000/micro-harness'
@@ -0,0 +1,981 @@
1
+ # Copyright 2008 the V8 project authors. All rights reserved.
2
+ # Copyright 1996 John Maloney and Mario Wolczko.
3
+
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+
18
+
19
+ # This implementation of the DeltaBlue benchmark is derived
20
+ # from the Smalltalk implementation by John Maloney and Mario
21
+ # Wolczko. Some parts have been translated directly, whereas
22
+ # others have been modified more aggresively to make it feel
23
+ # more like a JavaScript program.
24
+
25
+ # Transliterated directly to Ruby by Chris Seaton
26
+
27
+ def alert(message)
28
+ puts message
29
+ abort
30
+ end
31
+
32
+ #DeltaBlue = BenchmarkSuite.new('DeltaBlue', [66118], [
33
+ # Benchmark.new('DeltaBlue', true, false, deltaBlue)
34
+ #])
35
+
36
+ # A JavaScript implementation of the DeltaBlue constraint-solving
37
+ # algorithm, as described in:
38
+ #
39
+ # "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver"
40
+ # Bjorn N. Freeman-Benson and John Maloney
41
+ # January 1990 Communications of the ACM,
42
+ # also available as University of Washington TR 89-08-06.
43
+ #
44
+ # Beware: this benchmark is written in a grotesque style where
45
+ # the constraint model is built by side-effects from constructors.
46
+ # I've kept it this way to avoid deviating too much from the original
47
+ # implementation.
48
+
49
+
50
+ # --- O b j e c t M o d e l --- */
51
+
52
+ class OrderedCollection
53
+
54
+ def initialize
55
+ @elms = Array.new()
56
+ end
57
+
58
+ def add(elm)
59
+ @elms.push(elm)
60
+ end
61
+
62
+ def at(index)
63
+ return @elms[index]
64
+ end
65
+
66
+ def size()
67
+ return @elms.length
68
+ end
69
+
70
+ def removeFirst()
71
+ return @elms.pop()
72
+ end
73
+
74
+ def remove(elm)
75
+ index = 0
76
+ skipped = 0
77
+ i = 0
78
+ while i < @elms.length
79
+ value = @elms[i]
80
+ if (value != elm)
81
+ @elms[index] = value
82
+ index+= 1
83
+ else
84
+ skipped+= 1
85
+ end
86
+ i += 1
87
+ end
88
+ i = 0
89
+ while i < skipped
90
+ @elms.pop()
91
+ i += 1
92
+ end
93
+ end
94
+
95
+ end
96
+
97
+ # --- *
98
+ # S t r e n g t h
99
+ # --- */
100
+
101
+ # *
102
+ # Strengths are used to measure the relative importance of constraints.
103
+ # New strengths may be inserted in the strength hierarchy without
104
+ # disrupting current constraints. Strengths cannot be created outside
105
+ # this class, so pointer comparison can be used for value comparison.
106
+ # /
107
+
108
+ class Strength
109
+
110
+ attr_reader :strengthValue
111
+
112
+ def initialize(strengthValue, name)
113
+ @strengthValue = strengthValue
114
+ @name = name
115
+ end
116
+
117
+ def self.stronger(s1, s2)
118
+ return s1.strengthValue < s2.strengthValue
119
+ end
120
+
121
+ def self.weaker(s1, s2)
122
+ return s1.strengthValue > s2.strengthValue
123
+ end
124
+
125
+ def self.weakestOf(s1, s2)
126
+ return weaker(s1, s2) ? s1 : s2
127
+ end
128
+
129
+ def self.strongest(s1, s2)
130
+ return stronger(s1, s2) ? s1 : s2
131
+ end
132
+
133
+ def nextWeaker
134
+ case (@strengthValue)
135
+ when 0; return WEAKEST
136
+ when 1; return WEAK_DEFAULT
137
+ when 2; return NORMAL
138
+ when 3; return STRONG_DEFAULT
139
+ when 4; return PREFERRED
140
+ when 5; return REQUIRED
141
+ end
142
+ end
143
+
144
+ # Strength constants.
145
+ REQUIRED = new(0, "required")
146
+ STONG_PREFERRED = new(1, "strongPreferred")
147
+ PREFERRED = new(2, "preferred")
148
+ STRONG_DEFAULT = new(3, "strongDefault")
149
+ NORMAL = new(4, "normal")
150
+ WEAK_DEFAULT = new(5, "weakDefault")
151
+ WEAKEST = new(6, "weakest")
152
+
153
+ end
154
+
155
+ # --- *
156
+ # C o n s t r a i n t
157
+ # --- */
158
+
159
+ # *
160
+ # An abstract class representing a system-maintainable relationship
161
+ # (or "constraint") between a set of variables. A constraint supplies
162
+ # a strength instance variable; concrete subclasses provide a means
163
+ # of storing the constrained variables and other information required
164
+ # to represent a constraint.
165
+ # /
166
+
167
+ class Constraint
168
+
169
+ attr_reader :strength
170
+
171
+ def initialize(strength)
172
+ @strength = strength
173
+ end
174
+
175
+ # *
176
+ # Activate this constraint and attempt to satisfy it.
177
+ # /
178
+ def addConstraint
179
+ addToGraph()
180
+ $planner.incrementalAdd(self)
181
+ end
182
+
183
+ # *
184
+ # Attempt to find a way to enforce this constraint. If successful,
185
+ # record the solution, perhaps modifying the current dataflow
186
+ # graph. Answer the constraint that this constraint overrides, if
187
+ # there is one, or nil, if there isn't.
188
+ # Assume: I am not already satisfied.
189
+ # /
190
+ def satisfy(mark)
191
+ chooseMethod(mark)
192
+ if (!isSatisfied())
193
+ alert("Could not satisfy a required constraint!") if (@strength == Strength::REQUIRED)
194
+ return nil
195
+ end
196
+ markInputs(mark)
197
+ out = output()
198
+ overridden = out.determinedBy
199
+ overridden.markUnsatisfied() if (overridden != nil)
200
+ out.determinedBy = self
201
+ alert("Cycle encountered") if (!$planner.addPropagate(self, mark))
202
+ out.mark = mark
203
+ return overridden
204
+ end
205
+
206
+ def destroyConstraint
207
+ if (isSatisfied())
208
+ $planner.incrementalRemove(self)
209
+ else
210
+ removeFromGraph()
211
+ end
212
+ end
213
+
214
+ # *
215
+ # Normal constraints are not input constraints. An input constraint
216
+ # is one that depends on external state, such as the mouse, the
217
+ # keybord, a clock, or some arbitraty piece of imperative code.
218
+ # /
219
+ def isInput
220
+ return false
221
+ end
222
+
223
+ end
224
+
225
+ # --- *
226
+ # U n a r y C o n s t r a i n t
227
+ # --- */
228
+
229
+ # *
230
+ # Abstract superclass for constraints having a single possible output
231
+ # variable.
232
+ # /
233
+
234
+ class UnaryConstraint < Constraint
235
+
236
+ def initialize(v, strength)
237
+ super(strength)
238
+ @myOutput = v
239
+ @satisfied = false
240
+ addConstraint()
241
+ end
242
+
243
+ #UnaryConstraint.inheritsFrom(Constraint)
244
+
245
+ # *
246
+ # Adds this constraint to the constraint graph
247
+ # /
248
+ def addToGraph
249
+ @myOutput.addConstraint(self)
250
+ @satisfied = false
251
+ end
252
+
253
+ # *
254
+ # Decides if this constraint can be satisfied and records that
255
+ # decision.
256
+ # /
257
+ def chooseMethod(mark)
258
+ @satisfied = (@myOutput.mark != mark) && Strength::stronger(@strength, @myOutput.walkStrength)
259
+ end
260
+
261
+ # *
262
+ # Returns true if this constraint is satisfied in the current solution.
263
+ # /
264
+ def isSatisfied
265
+ return @satisfied
266
+ end
267
+
268
+ def markInputs(mark)
269
+ # has no inputs
270
+ end
271
+
272
+ # *
273
+ # Returns the current output variable.
274
+ # /
275
+ def output
276
+ return @myOutput
277
+ end
278
+
279
+ # *
280
+ # Calculate the walkabout strength, the stay flag, and, if it is
281
+ # 'stay', the value for the current output of this constraint. Assume
282
+ # this constraint is satisfied.
283
+ # /
284
+ def recalculate
285
+ @myOutput.walkStrength = @strength
286
+ @myOutput.stay = !isInput()
287
+ execute() if (@myOutput.stay)# Stay optimization
288
+ end
289
+
290
+ # *
291
+ # Records that this constraint is unsatisfied
292
+ # /
293
+ def markUnsatisfied
294
+ @satisfied = false
295
+ end
296
+
297
+ def inputsKnown(x)
298
+ return true
299
+ end
300
+
301
+ def removeFromGraph
302
+ @myOutput.removeConstraint(self) if (@myOutput != nil)
303
+ @satisfied = false
304
+ end
305
+
306
+ end
307
+
308
+ # --- *
309
+ # S t a y C o n s t r a i n t
310
+ # --- */
311
+
312
+ # *
313
+ # Variables that should, with some level of preference, stay the same.
314
+ # Planners may exploit the fact that instances, if satisfied, will not
315
+ # change their output during plan execution. This is called "stay
316
+ # optimization".
317
+ # /
318
+
319
+ class StayConstraint < UnaryConstraint
320
+
321
+ def initialize(v, str)
322
+ super(v, str)
323
+ end
324
+
325
+ #StayConstraint.inheritsFrom(UnaryConstraint)
326
+
327
+ def execute
328
+ # Stay constraints do nothing
329
+ end
330
+
331
+ end
332
+
333
+ # --- *
334
+ # E d i t C o n s t r a i n t
335
+ # --- */
336
+
337
+ # *
338
+ # A unary input constraint used to mark a variable that the client
339
+ # wishes to change.
340
+ # /
341
+
342
+ class EditConstraint < UnaryConstraint
343
+
344
+ def initialize(v, str)
345
+ super(v, str)
346
+ end
347
+
348
+ #EditConstraint.inheritsFrom(UnaryConstraint)
349
+
350
+ # *
351
+ # Edits indicate that a variable is to be changed by imperative code.
352
+ # /
353
+ def isInput
354
+ return true
355
+ end
356
+
357
+ def execute
358
+ # Edit constraints do nothing
359
+ end
360
+
361
+ end
362
+
363
+ # --- *
364
+ # B i n a r y C o n s t r a i n t
365
+ # --- */
366
+
367
+ module Direction
368
+ NONE = 0
369
+ FORWARD = 1
370
+ BACKWARD = -1
371
+ end
372
+
373
+ class BinaryConstraint < Constraint
374
+
375
+ # *
376
+ # Abstract superclass for constraints having two possible output
377
+ # variables.
378
+ # /
379
+ def initialize(var1, var2, strength)
380
+ super(strength)
381
+ @v1 = var1
382
+ @v2 = var2
383
+ @direction = Direction::NONE
384
+ addConstraint()
385
+ end
386
+
387
+ #BinaryConstraint.inheritsFrom(Constraint)
388
+
389
+ # *
390
+ # Decides if this constraint can be satisfied and which way it
391
+ # should flow based on the relative strength of the variables related,
392
+ # and record that decision.
393
+ # /
394
+ def chooseMethod(mark)
395
+ if (@v1.mark == mark)
396
+ @direction = (@v2.mark != mark && Strength::stronger(@strength, @v2.walkStrength)) ? Direction::FORWARD : Direction::NONE
397
+ return
398
+ end
399
+ if (@v2.mark == mark)
400
+ @direction = (@v1.mark != mark && Strength::stronger(@strength, @v1.walkStrength)) ? Direction::BACKWARD : Direction::NONE
401
+ return
402
+ end
403
+ if (Strength::weaker(@v1.walkStrength, @v2.walkStrength))
404
+ @direction = Strength::stronger(@strength, @v1.walkStrength) ? Direction::BACKWARD : Direction::NONE
405
+ else
406
+ @direction = Strength::stronger(@strength, @v2.walkStrength) ? Direction::FORWARD : Direction::BACKWARD
407
+ end
408
+ end
409
+
410
+ # *
411
+ # Add this constraint to the constraint graph
412
+ # /
413
+ def addToGraph
414
+ @v1.addConstraint(self)
415
+ @v2.addConstraint(self)
416
+ @direction = Direction::NONE
417
+ end
418
+
419
+ # *
420
+ # Answer true if this constraint is satisfied in the current solution.
421
+ # /
422
+ def isSatisfied
423
+ return @direction != Direction::NONE
424
+ end
425
+
426
+ # *
427
+ # Mark the input variable with the given mark.
428
+ # /
429
+ def markInputs(mark)
430
+ input().mark = mark
431
+ end
432
+
433
+ # *
434
+ # Returns the current input variable
435
+ # /
436
+ def input
437
+ return (@direction == Direction::FORWARD) ? @v1 : @v2
438
+ end
439
+
440
+ # *
441
+ # Returns the current output variable
442
+ # /
443
+ def output
444
+ return (@direction == Direction::FORWARD) ? @v2 : @v1
445
+ end
446
+
447
+ # *
448
+ # Calculate the walkabout strength, the stay flag, and, if it is
449
+ # 'stay', the value for the current output of this
450
+ # constraint. Assume this constraint is satisfied.
451
+ # /
452
+ def recalculate
453
+ ihn = input()
454
+ out = output()
455
+ out.walkStrength = Strength::weakestOf(@strength, ihn.walkStrength)
456
+ out.stay = ihn.stay
457
+ execute() if (out.stay)
458
+ end
459
+
460
+ # *
461
+ # Record the fact that this constraint is unsatisfied.
462
+ # /
463
+ def markUnsatisfied
464
+ @direction = Direction::NONE
465
+ end
466
+
467
+ def inputsKnown(mark)
468
+ i = input()
469
+ return i.mark == mark || i.stay || i.determinedBy == nil
470
+ end
471
+
472
+ def removeFromGraph
473
+ @v1.removeConstraint(self) if (@v1 != nil)
474
+ @v2.removeConstraint(self) if (@v2 != nil)
475
+ @direction = Direction::NONE
476
+ end
477
+
478
+ end
479
+
480
+ # --- *
481
+ # S c a l e C o n s t r a i n t
482
+ # --- */
483
+
484
+ # *
485
+ # Relates two variables by the linear scaling relationship: "v2 =
486
+ # (v1 * scale) + offset". Either v1 or v2 may be changed to maintain
487
+ # this relationship but the scale factor and offset are considered
488
+ # read-only.
489
+ # /
490
+
491
+ class ScaleConstraint < BinaryConstraint
492
+
493
+ def initialize(src, scale, offset, dest, strength)
494
+ @direction = Direction::NONE
495
+ @scale = scale
496
+ @offset = offset
497
+ super(src, dest, strength)
498
+ end
499
+
500
+ #ScaleConstraint.inheritsFrom(BinaryConstraint)
501
+
502
+ # *
503
+ # Adds this constraint to the constraint graph.
504
+ # /
505
+ def addToGraph
506
+ super
507
+ @scale.addConstraint(self)
508
+ @offset.addConstraint(self)
509
+ end
510
+
511
+ def removeFromGraph
512
+ super
513
+ @scale.removeConstraint(self) if (@scale != nil)
514
+ @offset.removeConstraint(self) if (@offset != nil)
515
+ end
516
+
517
+ def markInputs(mark)
518
+ super(mark)
519
+ @scale.mark = @offset.mark = mark
520
+ end
521
+
522
+ # *
523
+ # Enforce this constraint. Assume that it is satisfied.
524
+ # /
525
+ def execute
526
+ if (@direction == Direction::FORWARD)
527
+ @v2.value = @v1.value * @scale.value + @offset.value
528
+ else
529
+ @v1.value = (@v2.value - @offset.value) / @scale.value
530
+ end
531
+ end
532
+
533
+ # *
534
+ # Calculate the walkabout strength, the stay flag, and, if it is
535
+ # 'stay', the value for the current output of this constraint. Assume
536
+ # this constraint is satisfied.
537
+ # /
538
+ def recalculate
539
+ ihn = input()
540
+ out = output()
541
+ out.walkStrength = Strength.weakestOf(@strength, ihn.walkStrength)
542
+ out.stay = ihn.stay && @scale.stay && @offset.stay
543
+ execute() if (out.stay)
544
+ end
545
+
546
+ end
547
+
548
+ # --- *
549
+ # E q u a l i t y C o n s t r a i n t
550
+ # --- */
551
+
552
+ # *
553
+ # Constrains two variables to have the same value.
554
+ # /
555
+
556
+ class EqualityConstraint < BinaryConstraint
557
+
558
+ def initialize(var1, var2, strength)
559
+ super(var1, var2, strength)
560
+ end
561
+
562
+ #EqualityConstraint.inheritsFrom(BinaryConstraint)
563
+
564
+ # *
565
+ # Enforce this constraint. Assume that it is satisfied.
566
+ # /
567
+ def execute
568
+ output().value = input().value
569
+ end
570
+
571
+ end
572
+
573
+ # --- *
574
+ # V a r i a b l e
575
+ # --- */
576
+
577
+ # *
578
+ # A constrained variable. In addition to its value, it maintain the
579
+ # structure of the constraint graph, the current dataflow graph, and
580
+ # various parameters of interest to the DeltaBlue incremental
581
+ # constraint solver.
582
+ # */
583
+
584
+ class Variable
585
+
586
+ attr_accessor :mark, :walkStrength, :determinedBy, :stay, :value, :constraints
587
+
588
+ def initialize(name, initialValue = nil)
589
+ @value = initialValue || 0
590
+ @constraints = OrderedCollection.new()
591
+ @determinedBy = nil
592
+ @mark = 0
593
+ @walkStrength = Strength::WEAKEST
594
+ @stay = true
595
+ @name = name
596
+ end
597
+
598
+ # *
599
+ # Add the given constraint to the set of all constraints that refer
600
+ # this variable.
601
+ # /
602
+ def addConstraint(c)
603
+ @constraints.add(c)
604
+ end
605
+
606
+ # *
607
+ # Removes all traces of c from this variable.
608
+ # /
609
+ def removeConstraint(c)
610
+ @constraints.remove(c)
611
+ @determinedBy = nil if (@determinedBy == c)
612
+ end
613
+
614
+ end
615
+
616
+ # --- *
617
+ # P l a n n e r
618
+ # --- */
619
+
620
+ # *
621
+ # The DeltaBlue planner
622
+ # /
623
+
624
+ class Planner
625
+
626
+ def initialize()
627
+ @currentMark = 0
628
+ end
629
+
630
+ # *
631
+ # Attempt to satisfy the given constraint and, if successful,
632
+ # incrementally update the dataflow graph. Details: If satifying
633
+ # the constraint is successful, it may override a weaker constraint
634
+ # on its output. The algorithm attempts to resatisfy that
635
+ # constraint using some other method. This process is repeated
636
+ # until either a) it reaches a variable that was not previously
637
+ # determined by any constraint or b) it reaches a constraint that
638
+ # is too weak to be satisfied using any of its methods. The
639
+ # variables of constraints that have been processed are marked with
640
+ # a unique mark value so that we know where we've been. This allows
641
+ # the algorithm to avoid getting into an infinite loop even if the
642
+ # constraint graph has an inadvertent cycle.
643
+ # /
644
+ def incrementalAdd(c)
645
+ mark = newMark()
646
+ overridden = c.satisfy(mark)
647
+ while (overridden != nil)
648
+ overridden = overridden.satisfy(mark)
649
+ end
650
+ end
651
+
652
+ # *
653
+ # Entry point for retracting a constraint. Remove the given
654
+ # constraint and incrementally update the dataflow graph.
655
+ # Details: Retracting the given constraint may allow some currently
656
+ # unsatisfiable downstream constraint to be satisfied. We therefore collect
657
+ # a list of unsatisfied downstream constraints and attempt to
658
+ # satisfy each one in turn. This list is traversed by constraint
659
+ # strength, strongest first, as a heuristic for avoiding
660
+ # unnecessarily adding and then overriding weak constraints.
661
+ # Assume: c is satisfied.
662
+ # /
663
+ def incrementalRemove(c)
664
+ out = c.output()
665
+ c.markUnsatisfied()
666
+ c.removeFromGraph()
667
+ unsatisfied = removePropagateFrom(out)
668
+ strength = Strength::REQUIRED
669
+ while true
670
+ i = 0
671
+ while i < unsatisfied.size()
672
+ u = unsatisfied.at(i)
673
+ incrementalAdd(u) if (u.strength == strength)
674
+ i += 1
675
+ end
676
+ strength = strength.nextWeaker()
677
+ break unless (strength != Strength::WEAKEST)
678
+ end
679
+ end
680
+
681
+ # *
682
+ # Select a previously unused mark value.
683
+ # /
684
+ def newMark
685
+ return @currentMark += 1
686
+ end
687
+
688
+ # *
689
+ # Extract a plan for resatisfaction starting from the given source
690
+ # constraints, usually a set of input constraints. This method
691
+ # assumes that stay optimization is desired; the plan will contain
692
+ # only constraints whose output variables are not stay. Constraints
693
+ # that do no computation, such as stay and edit constraints, are
694
+ # not included in the plan.
695
+ # Details: The outputs of a constraint are marked when it is added
696
+ # to the plan under construction. A constraint may be appended to
697
+ # the plan when all its input variables are known. A variable is
698
+ # known if either a) the variable is marked (indicating that has
699
+ # been computed by a constraint appearing earlier in the plan), b)
700
+ # the variable is 'stay' (i.e. it is a constant at plan execution
701
+ # time), or c) the variable is not determined by any
702
+ # constraint. The last provision is for past states of history
703
+ # variables, which are not stay but which are also not computed by
704
+ # any constraint.
705
+ # Assume: sources are all satisfied.
706
+ # /
707
+ def makePlan(sources)
708
+ mark = newMark()
709
+ plan = Plan.new()
710
+ todo = sources
711
+ while (todo.size() > 0)
712
+ c = todo.removeFirst()
713
+ if (c.output().mark != mark && c.inputsKnown(mark))
714
+ plan.addConstraint(c)
715
+ c.output().mark = mark
716
+ addConstraintsConsumingTo(c.output(), todo)
717
+ end
718
+ end
719
+ return plan
720
+ end
721
+
722
+ # *
723
+ # Extract a plan for resatisfying starting from the output of the
724
+ # given constraints, usually a set of input constraints.
725
+ # /
726
+ def extractPlanFromConstraints(constraints)
727
+ sources = OrderedCollection.new()
728
+ i = 0
729
+ while i < constraints.size()
730
+ c = constraints.at(i)
731
+ sources.add(c) if (c.isInput() && c.isSatisfied())
732
+ i += 1
733
+ end
734
+ return makePlan(sources)
735
+ end
736
+
737
+ # *
738
+ # Recompute the walkabout strengths and stay flags of all variables
739
+ # downstream of the given constraint and recompute the actual
740
+ # values of all variables whose stay flag is true. If a cycle is
741
+ # detected, remove the given constraint and answer
742
+ # false. Otherwise, answer true.
743
+ # Details: Cycles are detected when a marked variable is
744
+ # encountered downstream of the given constraint. The sender is
745
+ # assumed to have marked the inputs of the given constraint with
746
+ # the given mark. Thus, encountering a marked node downstream of
747
+ # the output constraint means that there is a path from the
748
+ # constraint's output to one of its inputs.
749
+ # /
750
+ def addPropagate(c, mark)
751
+ todo = OrderedCollection.new()
752
+ todo.add(c)
753
+ while (todo.size() > 0)
754
+ d = todo.removeFirst()
755
+ if (d.output().mark == mark)
756
+ incrementalRemove(c)
757
+ return false
758
+ end
759
+ d.recalculate()
760
+ addConstraintsConsumingTo(d.output(), todo)
761
+ end
762
+ return true
763
+ end
764
+
765
+
766
+ # *
767
+ # Update the walkabout strengths and stay flags of all variables
768
+ # downstream of the given constraint. Answer a collection of
769
+ # unsatisfied constraints sorted in order of decreasing strength.
770
+ # /
771
+ def removePropagateFrom(out)
772
+ out.determinedBy = nil
773
+ out.walkStrength = Strength::WEAKEST
774
+ out.stay = true
775
+ unsatisfied = OrderedCollection.new()
776
+ todo = OrderedCollection.new()
777
+ todo.add(out)
778
+ while (todo.size() > 0)
779
+ v = todo.removeFirst()
780
+ i = 0
781
+ while i < v.constraints.size()
782
+ c = v.constraints.at(i)
783
+ unsatisfied.add(c) if (!c.isSatisfied())
784
+ i += 1
785
+ end
786
+ determining = v.determinedBy
787
+ i = 0
788
+ while i < v.constraints.size()
789
+ next_ = v.constraints.at(i)
790
+ if (next_ != determining && next_.isSatisfied())
791
+ next_.recalculate()
792
+ todo.add(next_.output())
793
+ end
794
+ i += 1
795
+ end
796
+ end
797
+ return unsatisfied
798
+ end
799
+
800
+ def addConstraintsConsumingTo(v, coll)
801
+ determining = v.determinedBy
802
+ cc = v.constraints
803
+ i = 0
804
+ while i < cc.size()
805
+ c = cc.at(i)
806
+ coll.add(c) if (c != determining && c.isSatisfied())
807
+ i += 1
808
+ end
809
+ end
810
+
811
+ end
812
+
813
+ # --- *
814
+ # P l a n
815
+ # --- */
816
+
817
+ # *
818
+ # A Plan is an ordered list of constraints to be executed in sequence
819
+ # to resatisfy all currently satisfiable constraints in the face of
820
+ # one or more changing inputs.
821
+ # /
822
+
823
+ class Plan
824
+
825
+ def initialize()
826
+ @v = OrderedCollection.new()
827
+ end
828
+
829
+ def addConstraint(c)
830
+ @v.add(c)
831
+ end
832
+
833
+ def size
834
+ return @v.size()
835
+ end
836
+
837
+ def constraintAt(index)
838
+ return @v.at(index)
839
+ end
840
+
841
+ def execute
842
+ i = 0
843
+ while i < size()
844
+ c = constraintAt(i)
845
+ c.execute()
846
+ i += 1
847
+ end
848
+ end
849
+
850
+ end
851
+
852
+ # --- *
853
+ # M a i n
854
+ # --- */
855
+
856
+ # *
857
+ # This is the standard DeltaBlue benchmark. A long chain of equality
858
+ # constraints is constructed with a stay constraint on one end. An
859
+ # edit constraint is then added to the opposite end and the time is
860
+ # measured for adding and removing this constraint, and extracting
861
+ # and executing a constraint satisfaction plan. There are two cases.
862
+ # In case 1, the added constraint is stronger than the stay
863
+ # constraint and values must propagate down the entire length of the
864
+ # chain. In case 2, the added constraint is weaker than the stay
865
+ # constraint so it cannot be accomodated. The cost in this case is,
866
+ # of course, very low. Typical situations lie somewhere between these
867
+ # two extremes.
868
+ # /
869
+ def chainTest(n)
870
+ $planner = Planner.new()
871
+ prev = nil
872
+ first = nil
873
+ last = nil
874
+
875
+ # Build chain of n equality constraints
876
+ i = 0
877
+ while i <= n
878
+ name = "v" + i.to_s
879
+ v = Variable.new(name)
880
+ if (prev != nil)
881
+ EqualityConstraint.new(prev, v, Strength::REQUIRED)
882
+ end
883
+ first = v if (i == 0)
884
+ last = v if (i == n)
885
+ prev = v
886
+ i += 1
887
+ end
888
+
889
+ StayConstraint.new(last, Strength::STRONG_DEFAULT)
890
+ edit = EditConstraint.new(first, Strength::PREFERRED)
891
+ edits = OrderedCollection.new()
892
+ edits.add(edit)
893
+ plan = $planner.extractPlanFromConstraints(edits)
894
+ i = 0
895
+ while i < 100
896
+ first.value = i
897
+ plan.execute()
898
+ alert("Chain test failed.") if (last.value != i)
899
+ i += 1
900
+ end
901
+ end
902
+
903
+ # *
904
+ # This test constructs a two sets of variables related to each
905
+ # other by a simple linear transformation (scale and offset). The
906
+ # time is measured to change a variable on either side of the
907
+ # mapping and to change the scale and offset factors.
908
+ # /
909
+ def projectionTest(n)
910
+ $planner = Planner.new()
911
+ scale = Variable.new("scale", 10)
912
+ offset = Variable.new("offset", 1000)
913
+ src = nil
914
+ dst = nil
915
+
916
+ dests = OrderedCollection.new()
917
+ i = 0
918
+ while i < n
919
+ src = Variable.new("src" + i.to_s, i)
920
+ dst = Variable.new("dst" + i.to_s, i)
921
+ dests.add(dst)
922
+ StayConstraint.new(src, Strength::NORMAL)
923
+ ScaleConstraint.new(src, scale, offset, dst, Strength::REQUIRED)
924
+ i += 1
925
+ end
926
+
927
+ change(src, 17)
928
+ alert("Projection 1 failed") if (dst.value != 1170)
929
+ change(dst, 1050)
930
+ alert("Projection 2 failed") if (src.value != 5)
931
+ change(scale, 5)
932
+ i = 0
933
+ while i < n - 1
934
+ alert("Projection 3 failed") if (dests.at(i).value != i * 5 + 1000)
935
+ i += 1
936
+ end
937
+ change(offset, 2000)
938
+ i = 0
939
+ while i < n - 1
940
+ alert("Projection 4 failed") if (dests.at(i).value != i * 5 + 2000)
941
+ i += 1
942
+ end
943
+ end
944
+
945
+ def change(v, newValue)
946
+ edit = EditConstraint.new(v, Strength::PREFERRED)
947
+ edits = OrderedCollection.new()
948
+ edits.add(edit)
949
+ plan = $planner.extractPlanFromConstraints(edits)
950
+ i = 0
951
+ while i < 10
952
+ v.value = newValue
953
+ plan.execute()
954
+ i += 1
955
+ end
956
+ edit.destroyConstraint()
957
+ end
958
+
959
+ # Global variable holding the current planner.
960
+ $planner = nil
961
+
962
+ def deltaBlue()
963
+ chainTest(100)
964
+ projectionTest(100)
965
+ end
966
+
967
+ def harness_input
968
+ 10_000
969
+ end
970
+
971
+ def harness_sample(input)
972
+ chainTest(input)
973
+ projectionTest(input)
974
+ end
975
+
976
+ def harness_verify(output)
977
+ # Self-verifies
978
+ true
979
+ end
980
+
981
+ require 'bench9000/harness'