[scala] minimized scala-library.jar for scala applets

View: New views
6 Messages — Rating Filter:   Alert me  

[scala] minimized scala-library.jar for scala applets

by Jim McBeath-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have written a small applet in Scala that I would like to make
available to anyone who has installed the standard Java plug-in
without requiring them to separately install scala-library.jar.
I am able to do that now by listing both my own jar file
and scala-library.jar in the archive attribute of the applet
element in my html file.  However, my jar file is about 150K and
scala-library.jar is about 3M.

I suspect that my applet does not need most of the classes in
scala-library.jar.  If I could easily extract from the latter only
the classes I need, I could create a smaller scala-my-app.jar file
with just those classes and improve download time.  Does anyone
know of a tool that I can use to recursively determine the set
of classes referenced by my code so that I can build such a jar
file automatically?

--
Jim

Re: [scala] minimized scala-library.jar for scala applets

by Miles Sabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Aug 1, 2008 at 4:09 PM, Jim McBeath <scala@...> wrote:
> Does anyone know of a tool that I can use to recursively determine
> the set of classes referenced by my code so that I can build such a jar
> file automatically?

I looked at various tools of this sort fairly recently, and the best
free and open source option I found was ProGuard,

  http://proguard.sourceforge.net/

It was able to handle quite an impressively complex codebase (a
biggish chunk of the Eclipse JDT, to be precise) ...

Cheers,


Miles

Re: [scala] minimized scala-library.jar for scala applets

by Miles Sabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Aug 1, 2008 at 4:18 PM, Miles Sabin <miles@...> wrote:
> I looked at various tools of this sort fairly recently, and the best
> free and open source option I found was ProGuard,

Oh, and the author provides a fairly comprehensive looking list of alternatives,

  http://proguard.sourceforge.net/alternatives.html

Cheers,


Miles

Re: [scala] minimized scala-library.jar for scala applets

by Sean McDirmid :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think we'd eventually have to split up scala-library.jar if applets become popular again. I mean, we already have core Scala (scala.*), and services (actors, parser combinators) which are definitely not used in every applet.

Sean

On Fri, Aug 1, 2008 at 11:21 PM, Miles Sabin <miles@...> wrote:
On Fri, Aug 1, 2008 at 4:18 PM, Miles Sabin <miles@...> wrote:
> I looked at various tools of this sort fairly recently, and the best
> free and open source option I found was ProGuard,

Oh, and the author provides a fairly comprehensive looking list of alternatives,

 http://proguard.sourceforge.net/alternatives.html

Cheers,


Miles


Re: [scala] minimized scala-library.jar for scala applets

by Jim McBeath-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I happen to be using parser combinators in this applet.  I saw
another scala applet that had a pruned down scala-library that
was only about 200K.  Packaging my own applet-specific version of
scala-library.jar seems like a reasonable solution for now, until
the day when the Java plug-in contains scala-library.jar.

--
Jim

On Sat, Aug 02, 2008 at 01:10:46PM +0800, Sean McDirmid wrote:

>    I think we'd eventually have to split up scala-library.jar if applets
>    become popular again. I mean, we already have core Scala (scala.*), and
>    services (actors, parser combinators) which are definitely not used in
>    every applet.
>    Sean
>
>    On Fri, Aug 1, 2008 at 11:21 PM, Miles Sabin <miles@...>
>    wrote:
>
>    On Fri, Aug 1, 2008 at 4:18 PM, Miles Sabin <miles@...>
>    wrote:
>    > I looked at various tools of this sort fairly recently, and the best
>    > free and open source option I found was ProGuard,
>
>      Oh, and the author provides a fairly comprehensive looking list of
>      alternatives,
>       http://proguard.sourceforge.net/alternatives.html
>      Cheers,
>      Miles

Re: [scala] minimized scala-library.jar for scala applets

by Sean McDirmid :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You won't see that. Even the Java plugin is going to a minimal modular distribution. E.g., it will lazily download parts of the Java library on demand when they are first used. This gets the Java plugin download down a lot, and a lot of the large parts of the library (e.g., internationalization components) are never even downloaded by most users.

I have nothing against combinators being used in applets. But it is a bit ridiculous that its included in the scala-library.jar file if we want that component to be as minimal as possible (I don't think we really care right now, applets are pretty much still dead, everything is in Flash now).

Sean

On Sat, Aug 2, 2008 at 1:35 PM, Jim McBeath <scala@...> wrote:
I happen to be using parser combinators in this applet.  I saw
another scala applet that had a pruned down scala-library that
was only about 200K.  Packaging my own applet-specific version of
scala-library.jar seems like a reasonable solution for now, until
the day when the Java plug-in contains scala-library.jar.

--
Jim

On Sat, Aug 02, 2008 at 01:10:46PM +0800, Sean McDirmid wrote:
>    I think we'd eventually have to split up scala-library.jar if applets
>    become popular again. I mean, we already have core Scala (scala.*), and
>    services (actors, parser combinators) which are definitely not used in
>    every applet.
>    Sean
>
>    On Fri, Aug 1, 2008 at 11:21 PM, Miles Sabin <miles@...>
>    wrote:
>
>    On Fri, Aug 1, 2008 at 4:18 PM, Miles Sabin <miles@...>
>    wrote:
>    > I looked at various tools of this sort fairly recently, and the best
>    > free and open source option I found was ProGuard,
>
>      Oh, and the author provides a fairly comprehensive looking list of
>      alternatives,
>       http://proguard.sourceforge.net/alternatives.html
>      Cheers,
>      Miles