Skip to content

VM and Dartium don't respect @lazy and DeferredLibrary #10171

Closed

Description

@DartBot

This issue was originally filed by @sethladd


Consider this code:

import 'dart:html';
import 'dart:async';

@lazy
import 'reverser.dart';

const lazy = const DeferredLibrary('reverser', uri: './part.js');

void main() {
  print('in main');
  new Timer(const Duration(seconds:3), () {
    lazy.load().then((_) {
      print('library loaded');
      query("#sample_text_id")
        ..text = "Click me!"
        ..onClick.listen(reverseText);
    });
  });
}

void reverseText(MouseEvent event) {
  query("#sample_text_id").text = reverse(query("#sample_text_id").text);
}

In the network panel of Dev Tools, I see the request for reverser.dart immediately on page load. I was expecting now to see the request until after the Timer fires.

Activity

  1. DartBot commented on Apr 24, 2013

    @DartBot
    Author

    This comment was originally written by @mhausner


    Is there an agreed upon spec that defines semantics of annotations that the VM has to recognize and follow?

  2. DartBot commented on Apr 24, 2013

    @DartBot
    Author

    This comment was originally written by ventura....@gmail.com


    This seams like a very important performance feature that must be included in the vm and dartium. Could this also applies to html imports? I have followed the posts from ilya grigorik about 1 second load times for web pages and js deferring and other code loading is fundamental so i dont see any reason not to do it on the vm. I hope it comes soon to the vm also

  3. kasperl commented on Apr 25, 2013

    @kasperl

    We haven't really discussed this in details yet. It isn't clear what the VM is supposed to do -- I think dart2dart translation might be a part of the answer here.

    Changing to an "enhancement request".


    cc @peter-ahe-google.
    Removed Type-Defect label.
    Added Type-Enhancement, Area-VM, Triaged labels.

  4. iposva-google commented on Apr 25, 2013

    @iposva-google
    Contributor

    As Kasper said in comment 3, so far this has been discussed a deployment feature which you will get with dart2dart. The VMs involvement in supporting this ends with giving the dart2dart generated code access to loading sources lazily through a library call. This library API still needs to be specified though.

  5. iposva-google commented on Jun 5, 2013

    @iposva-google
    Contributor

    Removed Priority-Medium label.
    Added Priority-Unassigned label.

  6. sethladd commented on Jan 29, 2015

    @sethladd
    Contributor

    Added AssumedStale label.

  7. added
    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
    closed-obsoleteClosed as the reported issue is no longer relevant
    on Jan 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.closed-obsoleteClosed as the reported issue is no longer relevanttype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions