Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DartBot opened this issue Apr 24, 2013 · 6 comments
Closed

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

DartBot opened this issue Apr 24, 2013 · 6 comments

Comments

@DartBot
Copy link

@DartBot DartBot commented Apr 24, 2013

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.

@DartBot
Copy link
Author

@DartBot DartBot commented Apr 24, 2013

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?

@DartBot
Copy link
Author

@DartBot DartBot commented Apr 24, 2013

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

@kasperl
Copy link

@kasperl kasperl commented Apr 25, 2013

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.

@iposva-google
Copy link
Contributor

@iposva-google iposva-google commented Apr 25, 2013

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.

@iposva-google
Copy link
Contributor

@iposva-google iposva-google commented Jun 5, 2013

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

@sethladd
Copy link
Contributor

@sethladd sethladd commented Jan 29, 2015

Added AssumedStale label.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants