racket / plot

Other
39 stars 37 forks source link

Large zo file sizes #38

Closed samth closed 4 years ago

samth commented 6 years ago

Currently, many files in these packages have long compile times and very large zo file sizes, due to Typed Racket contract generation. This issue tracks reducing these problems.

In 6.11, here are the largest zo file sizes (all over 500k):

  527920 Oct 30 15:02 ./share/pkgs/htdp-lib/lang/private/compiled/beginner-funs_rkt.zo
  552840 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/mrlib/compiled/gif_rkt.zo
  559323 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/mrlib/compiled/bitmap-label_rkt.zo
  561546 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/images/compiled/logos_rkt.zo
 574192 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-3_rkt.zo
 574661 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-6_rkt.zo
 575781 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-5_rkt.zo
 576409 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-4_rkt.zo
 576831 Oct 30 15:13 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-2_rkt.zo
 579144 Oct 30 15:13 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-15_rkt.zo
 582794 Oct 30 15:13 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-14_rkt.zo
  588670 Oct 30 15:08 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot-bitmap_rkt.zo
  595188 Oct 30 15:03 ./share/pkgs/plot-lib/plot/private/common/compiled/draw-attribs_rkt.zo
  597535 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot2d_rkt.zo
  602273 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot2d-utils_rkt.zo
  606413 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot3d_rkt.zo
  618308 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot3d-utils_rkt.zo
  628042 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/surface_rkt.zo
  638885 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/line_rkt.zo
  643077 Oct 30 15:04 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/renderer_rkt.zo
  648771 Oct 30 15:04 ./share/pkgs/games/scribblings/compiled/chat-noir_scrbl.zo
  650643 Oct 30 15:03 ./share/pkgs/plot-lib/plot/private/common/compiled/draw_rkt.zo
  656339 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/renderer_rkt.zo
  658802 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/point_rkt.zo
  664922 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/contour_rkt.zo
  667496 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/rectangle_rkt.zo
  669010 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/decoration_rkt.zo
  669555 Oct 30 15:03 ./share/pkgs/plot-lib/plot/private/common/compiled/plot-device_rkt.zo
  670971 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/point_rkt.zo
  671577 Oct 30 15:04 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/plot-area_rkt.zo
  680971 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/rectangle_rkt.zo
  685532 Oct 30 15:02 ./share/pkgs/plot-lib/plot/private/common/compiled/types_rkt.zo
  687618 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/interval_rkt.zo
  689797 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/contour_rkt.zo
  706500 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/line_rkt.zo
  710123 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/isosurface_rkt.zo
  733293 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/decoration_rkt.zo
  760222 Oct 30 15:09 ./share/pkgs/typed-racket-more/typed/private/compiled/framework-types_rkt.zo
  782106 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/images/compiled/icons_rkt.zo
  837910 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/common/compiled/marching-cubes_rkt.zo
  838699 Oct 30 15:04 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/plot-area_rkt.zo
 847392 Oct 30 14:59 ./share/pkgs/gui-lib/framework/compiled/main_rkt.zo
 1110521 Oct 30 14:58 ./share/pkgs/syntax-color-lib/syntax-color/compiled/racket-lexer_rkt.zo
 1954919 Oct 30 15:10 ./share/pkgs/drracket/drracket/compiled/tool-lib_rkt.zo
 2217488 Oct 30 15:11 ./share/pkgs/racklog/tests/compiled/unit_rkt.zo
 2303470 Oct 30 15:08 ./share/pkgs/plot-gui-lib/plot/private/gui/compiled/plot2d_rkt.zo
 2312672 Oct 30 15:08 ./share/pkgs/plot-gui-lib/plot/private/gui/compiled/plot3d_rkt.zo
 2559847 Oct 30 15:09 ./share/pkgs/drracket/drracket/private/compiled/insert-large-letters_rkt.zo
 8804584 Oct 30 14:54 ./share/pkgs/web-server-lib/web-server/formlets/unsafe/compiled/input_rkt.zo

There are 49, and 29 are from various plot packages, including 2 of the 4 largest.

In a current (20180214-2e1a81b345) nightly snapshot, there is only one plot zo file over 500k, which is plot-lib/plot/private/common/marching-cubes.rkt and which is not large because of Typed Racket (changing to typed/racket/no-check doesn't affect zo file size). These reductions are due to #31 and #27 among others (also a change by @rfindler to racket/contract). Currently the largest zo sizes for plot are (all over 200k):

  209155 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/draw-attribs_rkt.zo
  227165 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/renderer_rkt.zo
  230836 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/surface_rkt.zo
  238563 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/decoration_rkt.zo
  241268 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/line_rkt.zo
  241524 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/ticks_rkt.zo
  247151 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/plot-area_rkt.zo
  251104 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/plot-device_rkt.zo
  252051 Feb 14 01:47 ./share/pkgs/plot-doc/plot/scribblings/compiled/renderer2d_scrbl.zo
  252976 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/types_rkt.zo
  254848 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/renderer_rkt.zo
  260098 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/contour_rkt.zo
  260599 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/draw_rkt.zo
  264888 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/point_rkt.zo
  265266 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/rectangle_rkt.zo
  275701 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/point_rkt.zo
  277213 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/rectangle_rkt.zo
  288376 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/contour_rkt.zo
  292205 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/interval_rkt.zo
  297586 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/isosurface_rkt.zo
  304001 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/line_rkt.zo
  307592 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/parameters_rkt.zo
  337916 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/plot-area_rkt.zo
  353862 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/decoration_rkt.zo
  837970 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/common/compiled/marching-cubes_rkt.zo

My next steps are to investigate what can be done to shrink these.

cc @stamourv @mflatt @rfindler @bennn

rfindler commented 6 years ago

yay!

samth commented 6 years ago

First results of this investigation: marching-cubes.rkt, the largest file (and marching-squares.rkt) is generating an enormous amount of code using macros itself, not related to TR.

alex-hhh commented 4 years ago

With the current master and Racket 7.7 (BC), only these files area above 200k (see the attached file for the full list).

202427 Jul  3 09:25 ./plot-lib/plot/private/plot3d/compiled/rectangle_rkt.zo (was 265266)
206196 Jul  3 09:25 ./plot-lib/plot/private/plot2d/compiled/point_rkt.zo (was 275701)
210551 Jul  3 09:25 ./plot-lib/plot/private/plot3d/compiled/contour_rkt.zo (was 2600980
221171 Jul  3 09:25 ./plot-lib/plot/private/plot3d/compiled/isosurface_rkt.zo (was 297586)
222475 Jul  3 09:25 ./plot-lib/plot/private/plot2d/compiled/interval_rkt.zo (was 292205)
222534 Jul  3 09:25 ./plot-lib/plot/private/plot2d/compiled/line_rkt.zo (was 304001)
226909 Jul  3 08:00 ./plot-lib/plot/private/common/compiled/ticks_rkt.zo 
254227 Jul  3 09:25 ./plot-lib/plot/private/plot3d/compiled/plot-area_rkt.zo (was 247151)
275367 Jul  3 09:25 ./plot-lib/plot/private/plot2d/compiled/decoration_rkt.zo (was 353862)
313260 Jul  3 09:24 ./plot-lib/plot/private/common/compiled/parameters_rkt.zo (was 307592)

In addition, the 837kb marching-cubes_rkt.zo is now 133kb.

Is this still an issue that is being worked on or can this issue be closed?

plot-zo-sizes.txt

samth commented 4 years ago

I have some long in-progress work that will further help here, but this doesn't need to be open any more.