[racket] #lang racket vs. racket/base

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Feb 12 10:55:16 EST 2014

Looks like most of the size increase from racket/date is that you're
pulling in the contract system. Still, there was some dead code in that
file whose removal let me remove a few requires from it (eliminating a
dependency on racket/match, since none of the things racket/date requires
require it). I'll push those changes later on today.

Robby



On Wed, Feb 12, 2014 at 7:59 AM, Manfred Lotz <manfred.lotz at arcor.de> wrote:

> On Wed, 12 Feb 2014 06:07:17 -0700
> Matthew Flatt <mflatt at cs.utah.edu> wrote:
>
> > At Wed, 12 Feb 2014 06:02:30 +0100, Manfred Lotz wrote:
> > > I just read Neil van Dyke's statement:
> > >
> > > < "#lang racket" is for demos, IMHO; I *always* use "#lang
> > > racket/base" < for any code that's not a demo.
> > >
> > > Question: What are the advantages of doing requires explicitly?
> > >
> > > In a program of mine I changed #lang racket to #lang racket/base and
> > > added:
> > >
> > > (require racket/cmdline)
> > > (require racket/string)
> > > (require racket/format)
> > > (require racket/port)
> > > (require racket/path)
> > > (require racket/list)
> > >
> > >
> > > The resulting executable (created by raco exe...) had the same size.
> >
> > I'm surprised that they were the same size, assuming that you didn't
> > import other libraries that have more dependencies.
> >
> > With these two files:
> >
> >  r.rkt
> >  -----
> >  #lang racket
> >
> >
>
> My system is a 64 bit Fedora 20.
>
> Size here is: 5045135
>
> >  b.rkt
> >  -----
> >  #lang racket/base
> >  (require racket/cmdline
> >           racket/string
> >           racket/format
> >           racket/port
> >           racket/path
> >           racket/list)
> >
> > on my machine, `raco exe b.rkt` produces a 2.4 MB executable, while
> > `raco exe r.rkt` produces a 5.2MB executable.
> >
>
> Hm, ok you are right. This one has size: 2123527
>
> I had to add more stuff:
>
> racket/date which makes it much larger: 4029753
>
>
> (require openssl)
> (require openssl/sha1)
>
> which makes a size of: 4511202
>
>
> In my source I found a mistake. I had a require for a file.rkt
> which still had racket instead of racket/base. Changing this saved me 1
> MB compared to the initial 5602007 bytes size.
>
>
> > There's a similarly significant difference in startup times for me:
> >
> >  laptop% time racket -l racket/base
> >  0.030u 0.013s 0:00.04 100.0% 0+0k 0+0io 0pf+0w
> >  laptop% time racket -l racket/base -l racket/string -l
> > racket/cmdline \ -l racket/format -l racket/port -l racket/path -l
> > racket/list 0.103u 0.029s 0:00.13 92.3%       0+0k 0+0io 0pf+0w
> >  laptop% time racket -l racket
> >  0.155u 0.041s 0:00.19 100.0% 0+0k 0+0io 0pf+0w
> >
>
> These times are similar on my system.
>
>
>
> --
> Manfred
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140212/2c8af473/attachment-0001.html>

Posted on the users mailing list.