Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2: Is it slow?

Just took a look at the last angular version that the angular team launch. Angular2 is out and they have been release a their new webpage https://angular.io.

In there they have a 5 min quickstart project that shows quickly the new syntax and what you have to use to perform a new angular application.

I just did all the steps to get it working but it took 4.93 seconds to load.

I'm just wondering, is angular 2 that slow? Or maybe I miss some steps.

Here is my code

// app.es6

import { Component, Template, bootstrap } from "angular2/angular2";

// Annotation section
@Component({
  selector: "my-app"
})
@Template({
  inline: "<h1>Hello {{ name }}</h1>"
})
// Component controller
class MyAppComponent {
  constructor() {
    this.name = "Alex!";
  }
}

bootstrap(MyAppComponent);

and index.html

<!-- index.html -->
<html>

<head>
    <title>Angular 2 Quickstart</title>
    <script src="dist/es6-shim.js"></script>
</head>

<body>

    <!-- The app component created in app.js -->
    <my-app></my-app>

    <script>
        // Rewrite the paths to load the files
          System.paths = {
            'angular2/*':'angular2/*.js', // Angular
            'rtts_assert/*': 'rtts_assert/*.js', //Runtime assertions
            'app': 'app.js' // The my-app component
          };

          // Kick off the application
          System.import('app');
    </script>
</body>

</html>
like image 528
Alejandro Garcia Anglada Avatar asked Mar 08 '15 12:03

Alejandro Garcia Anglada


People also ask

Why Angular is so slow?

If you've done your research and figured out that your app doesn't render that much and doesn't render that often, then your code may just simply be quite slow. This is probably due to some heavy scripting and not DOM-related. Use WebWorkers. The Angular CLI also provides a command to generate a WebWorker in a snap.

Is Angular JS slow?

Since its initial release, the AngularJS developed web applications have been comparatively slow. Almost every developer has faced performative issues with Angular.


1 Answers

  • You are running with RTTS (run-time type system checks) It is great for development, but slow for production
  • We have not concatenated all the files into single file for fast loading.
  • We still have the slow change detection, since the fast one is not yet working in Dart, and we want to be consistent.

See https://github.com/djsmith42/angular2_calendar on how to get it to run fast.

like image 90
Misko Hevery Avatar answered Sep 29 '22 11:09

Misko Hevery