w3ctech

ThinkJS 2.1: Supports TypeScript, and 90% Faster

ThinkJS 2.0 is the first Node.js framework that fully supports all new ES2015/ES2016 syntax, and it was released on Oct 30 2015. By using the new syntax such as */yield in ES2015 or async/await in ES2016, it totally avoided the infamous Callback Hell that is intrinsic in native Node.js code. With the helping of Babel compiling, the final applications' code can run stably on all mainstream versions of Node.js. Also, ThinkJS provides the auto-compiling and auto-updating mechanism, to spare the troublesome restarting of Node.js service.

After more than a month of intense development, ThinkJS 2.1 was finally released! Whether in terms of features or perfomance, this new release both have gained greatly improving and upgrading.

Supports TypeScript

TypeScript is a made by Microsoft language that "lets you write JavaScript the way you really want to". As a superset of JavaScript, Typescript has introduced the optional static data types, as you may know, that is significant for large projects.

ThinkJS 2.1 begins to support the creation of TypeScript projects, and during the development process, it runs the auto-compiling and auto-updating by default, free the developers from the messy manual operations like compiling. For more details, see here.

90% Faster

ThinkJS 2.1 has made many deep optimizations by make use of V8's trace(--trace-opt, --trace-inlining, --trace-gc). As the same time, it also replaced the native Bebal Promise library with the high performance bluebird library, that gives it much more performance promotion. Compare with ThinkJS 2.0, this release could make your applications run 90% faster.

To evaluate whether a framework is outstanding, not only needs to look at how many features it supports, but also needs to look at how fast it's code can run. Althought ThinkJS is designed to accelerate the development of large scale projects and because of this the features as well as the complexity it has are far beyound Express and Koa, but its performance is completely comparable with Express and Koa, the figure below shows us the tesing reslut.

The performance testing about ThinkJS

Note: The data in the above table comes from a distributed pressure testing system.

As the above data demonstrated, though the performance of ThinkJS is a little less than Express and Koa, but the differences between them are very small.

If you are care about the testing code, you can download it from here https://github.com/thinkjs-team/thinkjs-performance-test, and run it on yourself available environment. If you want to use the ab testing tool, please remember that it is very unstable in Mac environments, so the testing results may various from time to time.

Update to Babel 6

ThinkJS 2.0 use Babel 5 to compile your projects' code, and ThinkJS 2.1 has updated it to Babel 6. As a result, the back end code now could integrated with the front end code more seamlessly.

Multi-Levels Controllers

In traditional MVC patterns, there is only one level of Controller. To remedy this, ThinkJS 2.0 has supported Modules, but for very large projects, that is still not enough.

ThinkJS 2.1 begins to support multi-levels Controllers, that means you can create subdirectoreis in every Controller directory. The levels of the directories are totally depand on the demands of your projects. Finally, the multi-levels Controllers made ThinkJS could be used on various projects' complexity.

Supports PostgreSQL

ThinkJS 2.1 has supported PostgreSQL, so the amount of databases that ThinkJS supported has reached four. In the future releases, ThinkJS will continues to support more databases, and of course, the developers could always extend the ThinkJS's databases supporting themselves.

For more details about this release, please visit https://thinkjs.org/changelog.html.

w3ctech微信

扫码关注w3ctech微信公众号

共收到1条回复