Lazy loading

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Lazy loading

Blake McBride-2
Greetings,

I have an app with about 450 screens.  I must lazy load them as any particular use usually only uses a dozen or fewer screens but which group they use is case specific.  So, I'd like to be able to lazy load screens/functionality.

I believe Smalltalk on the desktop has an all-or-nothing image file.  I sense that Amber has a similar attitude.  This won't work for my use-case.  Is there a way to do this with Amber?

Thanks!

Blake McBride

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Lazy loading

Herby Vojčík


On May 1, 2018 4:17:10 PM GMT+02:00, Blake McBride <[hidden email]> wrote:
>Greetings,

Hi,

>I have an app with about 450 screens.  I must lazy load them as any

Impressive (and scary, a bit :-) )

>particular use usually only uses a dozen or fewer screens but which
>group
>they use is case specific.  So, I'd like to be able to lazy load
>screens/functionality.

I understand.

Basically, two main possibilities here - SPA that loads parts of code lazily, or actually different pages served from different urls (which then load only subset of code, but each of them loads Amber, of course). The second is a bit strange, but I am mentioning it for completeness.

>I believe Smalltalk on the desktop has an all-or-nothing image file.  I

Yes.

>sense that Amber has a similar attitude.  This won't work for my

Attitude, yes. Implementation - not completely so.

AFAICT most SPAs build a single .js bundle, to load faster. Amber does this as well, with `grunt deploy`.

So, what you find problematic, namely, not to have everything bundled and have ability to lazy-load, is IMO not Amber-specific.

To be more precise about "image" and Amber - there is no image and code is loaded from .ja files. In depliy scenario mentioned earlier, the whole app is bundled. In development scenario, packages are loaded separately, each from its own file.

Amber is, from Javascripter PoV, just a set of AMD libraries.

>use-case.  
>Is there a way to do this with Amber?

Lazy-loading in-process is not working atm  (https://lolg.it/amber/amber/issues/1197), but if you chose to use Amber, I may look into it, as I often fix Amber issues only after they actually block someone's work. With the above issue fixed, you should be able to load packages programmatically.

>Thanks!
>
>Blake McBride

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Lazy loading

Herby Vojčík


On May 1, 2018 5:28:29 PM GMT+02:00, Blake McBride <[hidden email]> wrote:
>Hello and thanks for responding so quickly.
>
>The app is a single page app in the sense that it doesn't have a URL
>for
>each page.  However, code & layout for each page gets lazy-loaded as it

Again, IMO, but, aren't good SPAs nowadays using HTML5 history API so they actually do have different URL for each screen (thus looking as if each screen loaded different page, and using this info when doing server-side render)? Amber dev server for example allows such SPAs to be developed by supplying fallback url.

>is
>requested.
>
>So, the lazy-load feature of Amber would be required.

Will take some time, but I presume it's doable (by initializing every uninitialized package at once).

>Thanks for the great system and communicating with me!
>
>Blake McBride
>
>
>
>On Tuesday, May 1, 2018 at 9:48:05 AM UTC-5, Herby wrote:
>>
>>
>>
>> On May 1, 2018 4:17:10 PM GMT+02:00, Blake McBride <[hidden email]
>
>> <javascript:>> wrote:
>> >Greetings,
>>
>> Hi,
>>
>
>
>
>
>>
>> >I have an app with about 450 screens.  I must lazy load them as any
>>
>> Impressive (and scary, a bit :-) )
>>
>
>
>
>
>>
>> >particular use usually only uses a dozen or fewer screens but which
>> >group
>> >they use is case specific.  So, I'd like to be able to lazy load
>> >screens/functionality.
>>
>> I understand.
>>
>> Basically, two main possibilities here - SPA that loads parts of code
>
>> lazily, or actually different pages served from different urls (which
>then
>> load only subset of code, but each of them loads Amber, of course).
>The
>> second is a bit strange, but I am mentioning it for completeness.
>>
>> >I believe Smalltalk on the desktop has an all-or-nothing image file.
> I
>>
>> Yes.
>>
>> >sense that Amber has a similar attitude.  This won't work for my
>>
>> Attitude, yes. Implementation - not completely so.
>>
>> AFAICT most SPAs build a single .js bundle, to load faster. Amber
>does
>> this as well, with `grunt deploy`.
>>
>> So, what you find problematic, namely, not to have everything bundled
>and
>> have ability to lazy-load, is IMO not Amber-specific.
>>
>> To be more precise about "image" and Amber - there is no image and
>code is
>> loaded from .ja files. In depliy scenario mentioned earlier, the
>whole app
>> is bundled. In development scenario, packages are loaded separately,
>each
>> from its own file.
>>
>> Amber is, from Javascripter PoV, just a set of AMD libraries.
>>
>> >use-case.  
>> >Is there a way to do this with Amber?
>>
>> Lazy-loading in-process is not working atm  (
>> https://lolg.it/amber/amber/issues/1197), but if you chose to use
>Amber,
>> I may look into it, as I often fix Amber issues only after they
>actually
>> block someone's work. With the above issue fixed, you should be able
>to
>> load packages programmatically.
>>
>> >Thanks!
>> >
>> >Blake McBride
>>
>> Herby
>>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Lazy loading

Blake McBride-2
Thank you very much!  Do you have a short overview of how to use it?

Thanks a lot!

Blake

On Tue, May 1, 2018 at 6:04 PM, Herbert Vojčík <[hidden email]> wrote:
Should be fixed in master.

Blake McBride wrote:


On Tuesday, May 1, 2018 at 10:59:49 AM UTC-5, Herby wrote:



    On May 1, 2018 5:28:29 PM GMT+02:00, Blake McBride
    <[hidden email] <javascript:>> wrote:
     >Hello and thanks for responding so quickly.
     >
     >The app is a single page app in the sense that it doesn't have a URL
     >for
     >each page.  However, code & layout for each page gets lazy-loaded
    as it

    Again, IMO, but, aren't good SPAs nowadays using HTML5 history API
    so they actually do have different URL for each screen (thus looking
    as if each screen loaded different page, and using this info when
    doing server-side render)? Amber dev server for example allows such
    SPAs to be developed by supplying fallback url.


Thanks.  In my case, the vast majority of the screens share the same framework where a portion of the actual screen represent the screens I am talking about.  They are mostly independent but which "screens" get loaded is determined by the framework.




     >is
     >requested.
     >
     >So, the lazy-load feature of Amber would be required.

    Will take some time, but I presume it's doable (by initializing
    every uninitialized package at once).

     >Thanks for the great system and communicating with me!
     >
     >Blake McBride
     >
     >
     >
     >On Tuesday, May 1, 2018 at 9:48:05 AM UTC-5, Herby wrote:
     >>
     >>
     >>
     >> On May 1, 2018 4:17:10 PM GMT+02:00, Blake McBride
    <[hidden email]
     >
     >> <javascript:>> wrote:
     >> >Greetings,
     >>
     >> Hi,
     >>
     >
     >
     >
     >
     >>
     >> >I have an app with about 450 screens.  I must lazy load them as
    any
     >>
     >> Impressive (and scary, a bit :-) )
     >>
     >
     >
     >
     >
     >>
     >> >particular use usually only uses a dozen or fewer screens but
    which
     >> >group
     >> >they use is case specific.  So, I'd like to be able to lazy load
     >> >screens/functionality.
     >>
     >> I understand.
     >>
     >> Basically, two main possibilities here - SPA that loads parts of
    code
     >
     >> lazily, or actually different pages served from different urls
    (which
     >then
     >> load only subset of code, but each of them loads Amber, of course).
     >The
     >> second is a bit strange, but I am mentioning it for completeness.
     >>
     >> >I believe Smalltalk on the desktop has an all-or-nothing image
    file.
     > I
     >>
     >> Yes.
     >>
     >> >sense that Amber has a similar attitude.  This won't work for my
     >>
     >> Attitude, yes. Implementation - not completely so.
     >>
     >> AFAICT most SPAs build a single .js bundle, to load faster. Amber
     >does
     >> this as well, with `grunt deploy`.
     >>
     >> So, what you find problematic, namely, not to have everything
    bundled
     >and
     >> have ability to lazy-load, is IMO not Amber-specific.
     >>
     >> To be more precise about "image" and Amber - there is no image and
     >code is
     >> loaded from .ja files. In depliy scenario mentioned earlier, the
     >whole app
     >> is bundled. In development scenario, packages are loaded
    separately,
     >each
     >> from its own file.
     >>
     >> Amber is, from Javascripter PoV, just a set of AMD libraries.
     >>
     >> >use-case.
     >> >Is there a way to do this with Amber?
     >>
     >> Lazy-loading in-process is not working atm  (
     >> https://lolg.it/amber/amber/issues/1197
    <https://lolg.it/amber/amber/issues/1197>), but if you chose to use
     >Amber,
     >> I may look into it, as I often fix Amber issues only after they
     >actually
     >> block someone's work. With the above issue fixed, you should be
    able
     >to
     >> load packages programmatically.
     >>
     >> >Thanks!
     >> >
     >> >Blake McBride
     >>
     >> Herby
     >>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email] <mailto:[hidden email]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Lazy loading

Blake McBride-2
In reply to this post by Herby Vojčík
Thanks!

On Wed, May 2, 2018 at 4:12 AM, <[hidden email]> wrote:
Well, actually, it isn't working correctly, I missed some details, but I know how to fix them.

Nevertheless, you can still use the API (even with official release yet) on already-loaded packages, so you can just start with the state where you have it all at included anyway, and later start actually lazying it. For example:

  Package
    load: 'Web'
    fromNamespace: 'amber/web'

I will change these loading APIs to return a Promise, so future-proof way to use it is:

  (Promise fromBlock: [
    Package
      load: 'Web'
      fromNamespace: 'amber/web' ])
  then: [ "do something” ].

Later the fromBlock: wrapper won't be needed.

Herby

On May 2, 2018 3:23:18 AM GMT+02:00, Blake McBride <[hidden email]> wrote:
>Thank you very much!  Do you have a short overview of how to use it?
>
>Thanks a lot!
>
>Blake
>
>On Tue, May 1, 2018 at 6:04 PM, Herbert Vojčík <[hidden email]>
>wrote:
>
>> Should be fixed in master.
>>
>> Blake McBride wrote:
>>
>>>
>>>
>>> On Tuesday, May 1, 2018 at 10:59:49 AM UTC-5, Herby wrote:
>>>
>>>
>>>
>>>     On May 1, 2018 5:28:29 PM GMT+02:00, Blake McBride
>>>     <[hidden email] <javascript:>> wrote:
>>>      >Hello and thanks for responding so quickly.
>>>      >
>>>      >The app is a single page app in the sense that it doesn't have
>a URL
>>>      >for
>>>      >each page.  However, code & layout for each page gets
>lazy-loaded
>>>     as it
>>>
>>>     Again, IMO, but, aren't good SPAs nowadays using HTML5 history
>API
>>>     so they actually do have different URL for each screen (thus
>looking
>>>     as if each screen loaded different page, and using this info
>when
>>>     doing server-side render)? Amber dev server for example allows
>such
>>>     SPAs to be developed by supplying fallback url.
>>>
>>>
>>> Thanks.  In my case, the vast majority of the screens share the same
>>> framework where a portion of the actual screen represent the screens
>I am
>>> talking about.  They are mostly independent but which "screens" get
>loaded
>>> is determined by the framework.
>>>
>>>
>>>
>>>
>>>      >is
>>>      >requested.
>>>      >
>>>      >So, the lazy-load feature of Amber would be required.
>>>
>>>     Will take some time, but I presume it's doable (by initializing
>>>     every uninitialized package at once).
>>>
>>>      >Thanks for the great system and communicating with me!
>>>      >
>>>      >Blake McBride
>>>      >
>>>      >
>>>      >
>>>      >On Tuesday, May 1, 2018 at 9:48:05 AM UTC-5, Herby wrote:
>>>      >>
>>>      >>
>>>      >>
>>>      >> On May 1, 2018 4:17:10 PM GMT+02:00, Blake McBride
>>>     <[hidden email]
>>>      >
>>>      >> <javascript:>> wrote:
>>>      >> >Greetings,
>>>      >>
>>>      >> Hi,
>>>      >>
>>>      >
>>>      >
>>>      >
>>>      >
>>>      >>
>>>      >> >I have an app with about 450 screens.  I must lazy load
>them as
>>>     any
>>>      >>
>>>      >> Impressive (and scary, a bit :-) )
>>>      >>
>>>      >
>>>      >
>>>      >
>>>      >
>>>      >>
>>>      >> >particular use usually only uses a dozen or fewer screens
>but
>>>     which
>>>      >> >group
>>>      >> >they use is case specific.  So, I'd like to be able to lazy
>load
>>>      >> >screens/functionality.
>>>      >>
>>>      >> I understand.
>>>      >>
>>>      >> Basically, two main possibilities here - SPA that loads
>parts of
>>>     code
>>>      >
>>>      >> lazily, or actually different pages served from different
>urls
>>>     (which
>>>      >then
>>>      >> load only subset of code, but each of them loads Amber, of
>>> course).
>>>      >The
>>>      >> second is a bit strange, but I am mentioning it for
>completeness.
>>>      >>
>>>      >> >I believe Smalltalk on the desktop has an all-or-nothing
>image
>>>     file.
>>>      > I
>>>      >>
>>>      >> Yes.
>>>      >>
>>>      >> >sense that Amber has a similar attitude.  This won't work
>for my
>>>      >>
>>>      >> Attitude, yes. Implementation - not completely so.
>>>      >>
>>>      >> AFAICT most SPAs build a single .js bundle, to load faster.
>Amber
>>>      >does
>>>      >> this as well, with `grunt deploy`.
>>>      >>
>>>      >> So, what you find problematic, namely, not to have
>everything
>>>     bundled
>>>      >and
>>>      >> have ability to lazy-load, is IMO not Amber-specific.
>>>      >>
>>>      >> To be more precise about "image" and Amber - there is no
>image and
>>>      >code is
>>>      >> loaded from .ja files. In depliy scenario mentioned earlier,
>the
>>>      >whole app
>>>      >> is bundled. In development scenario, packages are loaded
>>>     separately,
>>>      >each
>>>      >> from its own file.
>>>      >>
>>>      >> Amber is, from Javascripter PoV, just a set of AMD
>libraries.
>>>      >>
>>>      >> >use-case.
>>>      >> >Is there a way to do this with Amber?
>>>      >>
>>>      >> Lazy-loading in-process is not working atm  (
>>>      >> https://lolg.it/amber/amber/issues/1197
>>>     <https://lolg.it/amber/amber/issues/1197>), but if you chose to
>use
>>>      >Amber,
>>>      >> I may look into it, as I often fix Amber issues only after
>they
>>>      >actually
>>>      >> block someone's work. With the above issue fixed, you should
>be
>>>     able
>>>      >to
>>>      >> load packages programmatically.
>>>      >>
>>>      >> >Thanks!
>>>      >> >
>>>      >> >Blake McBride
>>>      >>
>>>      >> Herby
>>>      >>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>Groups
>>> "amber-lang" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>send an
>>> email to [hidden email] <mailto:
>>> [hidden email]>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.