[HN Gopher] Toward Condensers
       ___________________________________________________________________
        
       Toward Condensers
        
       Author : luu
       Score  : 73 points
       Date   : 2023-08-01 06:53 UTC (1 days ago)
        
 (HTM) web link (openjdk.org)
 (TXT) w3m dump (openjdk.org)
        
       | svieira wrote:
       | For those who follow along but don't do this for work or fun
       | (yet) is this a Futamora projection?
       | http://blog.sigfpe.com/2009/05/three-projections-of-doctor-f...
       | 
       | Or is this a simpler form of static analysis / partial runtime
       | optimization?
        
         | ithkuil wrote:
         | Minor Typo: Futamura
        
       | michaelfeathers wrote:
       | I'm wondering whether there is any reason why condensers can't be
       | used for all program optimization. It seems like the definition
       | would allow that:
       | 
       | > The primary means for shifting computation is the condenser. A
       | condenser is a component that transforms a program, yielding a
       | program that is semantically equivalent under a stated set of
       | constraints (e.g., "class X will not be redefined"), but may be
       | smaller, faster, or better suited to a particular execution
       | environment.
        
       | whartung wrote:
       | This sounds pretty nice. In Lisp, this would be considered a
       | "tree shaker" (mind I don't know how they're plan to use this).
       | 
       | Currently, we rely on the Java Module system to make reduced
       | runtimes. It works, but is necessarily coarse.
       | 
       | You'd think you'd be able run the application for a "suitable
       | amount of time, and a suitable amount of use cases" and monitor
       | what classes were loaded, etc. and use that information to make
       | the smallest runtime possible. The addition of the sealing
       | mechanism is a bonus, most apps simply don't need to be that
       | configurable and flexible. You could do that analysis once, and
       | update it manually (so you don't have to do it all the time), or
       | have some automated service that you run routinely.
       | 
       | I have a simple GUI program, getting ready to distribute. It's
       | 5000 lines of code, and has a couple of windows. Admittedly, it
       | also includes WebKit (which alone can be large), but with all the
       | the distribution is 70M. That's tuned using the module system, so
       | it leaves stuff out.
       | 
       | That's "good". Many other cross platform solutions are larger.
       | 
       | It would be great for something like this to knock that down to
       | 20M (cough).
        
         | ezst wrote:
         | I bet a majority of those 70M is WebKit itself, and I don't
         | think there's any way to "condense" any of this since it lives
         | outside of the JVM.
        
       | wavemode wrote:
       | Some context:
       | 
       | https://mail.openjdk.org/pipermail/discuss/2020-April/005429...
       | 
       | Earlier design notes:
       | 
       | https://openjdk.org/projects/leyden/notes/01-beginnings
       | 
       | https://openjdk.org/projects/leyden/notes/02-shift-and-const...
        
         | slowmovintarget wrote:
         | The end result of all of this would be to allow Java-based
         | programs to be packaged as static standalone executables. Java
         | apps wouldn't have to "warm up."
        
           | spockz wrote:
           | We already have this capability with graalvm today. Not sure
           | how condensors compare.
        
             | slowmovintarget wrote:
             | > Project Leyden will take inspiration from past efforts to
             | explore this space, including the GNU Compiler for Java [1]
             | and the Native Image feature of GraalVM [2]. Leyden will
             | add static images to the Java Platform Specification, and
             | we expect that GraalVM will evolve to implement that
             | Specification. Developers who use only the standard,
             | specified static-image feature will then be able to switch
             | with ease between Leyden (in the JDK), Native Image (in
             | GraalVM), and whatever other conforming implementations may
             | arise, choosing amongst tradeoffs of compile time, startup
             | time, and image size.
             | 
             | (From one of the links posted above)
        
           | eikenberry wrote:
           | They should have done this 20 years ago. The JVM has always
           | been a questionable discission.
        
       | gavinray wrote:
       | Reddit thread with additional discussion:
       | 
       | https://www.reddit.com/r/java/comments/15ere1m/toward_conden...
        
       | ur-whale wrote:
       | Condensers is an interesting concept and one that is IMO sorely
       | needed in many dev environments (to wit, the amount of work that
       | has been put in Zig to get the compile-time language to be as
       | powerful and compatible as possible with the real thing, and the
       | giant PITB that is doing these kind of things in e.g. C++)
       | 
       | Shame the conversation in this article is inextricably laced with
       | Java stuff.
        
         | belfthrow wrote:
         | I guess you missed the authors and / or the domain this was
         | posted on.
        
       ___________________________________________________________________
       (page generated 2023-08-02 23:01 UTC)