HN user

mezoni

-5 karma
Posts0
Comments26
View on HN
No posts found.

What a problem?

In a second case, after checking value, type of variable does not changed.

// Vraible "string" still have a non-nullble type here // What problem you found here? // Non-nullble type cannot be null even only because analyzed code. print(string.length); // Don't know it's non-null here.

// This is dead code, if you don't know if (string == null) return;

Но что мешает реализовывать back-end на языке Dart? Может быть убогость сопутствующего программного обеспечения? Вероятнее всего, да. Хороших драйверов для работы с базами данных для него днем с огнем не найти.

Отличная новость. Скоро Dart станет рекордсменом по числу выпущенных версий в год. Но, смею заметить, даже при таких темпах версия-строения так и не была выпущена версия Dart 2.0, но было заявлено (не так давно) о ее выходе в начале 2016 года. Как говорится, нам не привыкать к тому, что Google скажет и не сделает (в срок или совсем никогда).

Does this news means that Google Dart used only by the Google and does not used by other serious companies?

Or does this news means that Google has finally decided to use their own software product but the other serious companies still has not been decided to use Google Dart?

Other languages also compiles to JS (even better than Dart) and don't require JS interop and they also highly usable languages.

What exactly is great in Dart in comparison with these languages?

Just another language which compiles to Javascript. Till now with their own virtual machine. But already without their own Editor. And, as always, without any programming language roadmap.

> Newbie here. The "?" operator is the same used in Swift?. any difference?

This is the same as "accessor variant of the existential operator ?." in Coffescript.

I think that this was in the Coffeescript initially but in Dart this feature (operator) will come after four years of his life (2011-2015) as a great achievement of all time.

Difference in that the: Swift lives and develops. Dart is trying to survive.

All that developers rejected not so long ago (as inadmissible), now they are trying to use for survival (calling them as a new and fresh ideas).

Survival is when the developers throw overboard everything unnecessary (Chrome Dart VM, Dart Editor, Web Platform) and grasping at all that falls under the arm (old new ideas).

The list is very small.

And "Stack Overflow" is not intended to be a place where "discussion happening, where do I show off my Dart stuff?" as the author asks.

Limited only to Google mail list and Google+.

Google+ also not intended for a productive discussions.

> Do you really mean "physical address" here?

> External data is created precisely to efficiently access data allocated externally, because it allows direct raw access to a given region of memory (sans bounds checking).

Serach in code "Unsafe." and you understand what means "physical address" as a base and offset.

Eg.

  Unsafe.memorySet(base, offset, 0, size);
  Unsafe.memoryAllocate(size);
  Unsafe.writeInt8(base, offset, value);
https://gist.github.com/mezoni/f85b04bf19dab8333abf

> Truly efficient FFI has to be part of the VM, you can not implement efficient FFI from outside.

Evil of the "Truly efficient FFI" in that the it in many cases does not exists as such.

Benefit of "NOT Truly efficient FFI" in that the it in many cases it may be considered as acceptable in many cases (and exist in reality).

> Do you really mean "physical address" here?

See here.

https://gist.github.com/mezoni/f85b04bf19dab8333abf

> As I said, we have intermediate language, but we don't accept it from outside of VM (for now).

Your approach very bad.

It does not help in the case where other professionals in this area can help you make VM better and effective.

Do you use such a layer as a "Well structured intermediate language" in Dart VM?

> I don't understand the question. Dart VM uses intermediate representation when compiling, which is an implementation detail (unlike CLR IL - which well specified input to the VM essentially)

I think that optimizing code easy if it represent in suitable form (intermediate format) for optimizations.

Dart VM does have any specifications about how it represent code and data in such form (intermediate language).

Intermediate language in this case means nothing more than the an intermediate language itself (with documentation) but not a some clases written in C++ language in VM project.

Does you have it?

> Can't you just expose the data you are reading as an external typed data array to the Dart code? That would remove any need for those methods.

I work on integrating into Dart ecosysem "foreign functions interface" (ffi).

External typed data is not suitable in many cases:

- Does not provide physical storage address to use code (binary interop requires that)

- I don't need it because it heavyweight if use it with C pointers and references

- It has limit in size (specified in Dart VM on max array length)

- I need malloc and typed data does not help here in any way

- I access data (by physical address) allocated externally

> Did you file a bug for the slowness of your native extension?

This is useless. A long time ago we already did not come to a consensus.

> Annotation would be no less magic (and not available to the user code anyways).

Magic of annotations in that the they are only annotates but a real magic goes elsewhere...

They can be ignored and this is not a magic because they are only a metadata (data about data).

I think that Dart VM and Dart developers does not like annotations because they thinking that VM cannot use them effectively (even if they written by humans).

But Dart VM are more complex than V8 VM and a ways that uses developers to tell VM about how specify metadata about critical methods is not a very good.

========================

Are there attributes that affect how the CLR optimizes during a JIT compile?

http://stackoverflow.com/questions/2367094/are-there-attribu...

========================

Also

========================

MethodImplOptions Enumeration

http://msdn.microsoft.com/ru-ru/library/system.runtime.compi...

- Unmanaged

- ForwardRef

- PreserveSig

- InternalCall

- Synchronized

- NoInlining

- AggressiveInlining

- NoOptimization

========================

This is from:

"The System.Runtime.CompilerServices namespace provides functionality for compiler writers who use managed code to specify attributes in metadata that affect the run-time behavior of the common language runtime."

The fact that Dart is not a multi-layer VM does not means that it are simple this is good for optimizations.

Do you use such a layer as a "Well structured intermediate language" in Dart VM?

> so I don't really understand what bothers you about these lists.

This approach does not allow me to use annotations (or other way) for specifying that my own "native" methods in "native extension" are required some attention.

You use for such attention these lists.

Eg.

I have the following methods (via macro defs) in my "native extension":

=========================

  UNSAFE_READ_INT(8, int8_t)
  UNSAFE_READ_INT(16, int16_t)
  UNSAFE_READ_INT(32, int32_t)
  UNSAFE_READ_INT(64, int64_t)
  // Skipped
  UNSAFE_READ_FLOAT(32, float)
  UNSAFE_READ_FLOAT(64, double)
  // Skipped
=========================

These methods are very fast (in C++) but in fact Dart VM executes them (native methods) very SLOOOOOOOOOOOWWWWWWWWWWWW...

See my question on stack overflow:

========================= Why native wrapped functions in Dart are such heavyweight in comparison with “DEFINE NATIVE ENTRY” functions that are very lightweight?

http://stackoverflow.com/questions/21363429/why-native-wrapp... =========================

- Dart developers does not like annotation

- Dart VM does not uses annotation

- Dart VM does not uses type annotation

- Dart VM executes custom "native (which in fact are very fast)" methods very slow

This is what is means for me that Dart VM is not a very well balanced for high performance.

P.S.

This is why "I bothers you about these lists".

Because they are in some cases the only way to improve performance.

What's wrong with the following code?

https://github.com/dart-lang/bleeding_edge/blob/master/dart/...

===============================

class _IntegerImplementation extends _Num {

  @inline(INLINE.INTRINSICS)     // <============================

  int _bitAndFromInteger(int other) native "Integer_bitAndFromInteger";
}

===============================

The same method in CORE_INTEGER_LIB_INTRINSIC_LIST

https://github.com/dart-lang/bleeding_edge/blob/master/dart/...

===============================

V(_IntegerImplementation, _bitAndFromInteger, \ Integer_bitAndFromInteger, 504496713)

===============================

If Dart VM can use "patch class" declarations then why this "@inline" should be considered as a bad?

Maybe your answer in that the "Dart VM ignored all kind of annotations (including type annotations) why it should use this approach".

P.S.

This is a not a direct problem of dynamism (ignore annotations even if they hard coded in source).

Problem in that the Dart VM does not want rely on annotations (dynamism is better, determine everything at runtime or from magic lists).

In the AtScript, there is nothing out of the Dart (0%).

AtScript composed entirely of TypeScript (100%).

AtScript is superset of TypeScript.

Dart there and does not smell.

https://www.youtube.com/watch?v=lGdnh8QSPPk#t=1734

=====================

AtScript: Google’s new superset JavaScript runtime

http://sdtimes.com/atscript-googles-new-superset-javascript-...

AtScript is designed to run on top of not only ECMAScript 5 and the upcoming ECMAScript 6, but atop Microsoft’s superset TypeScript language as well.

=====================

Dart has the same relative to AtScript, as to the TypeScript.

That is no relationship and no communication between them.

> This is a very misguided comment. > Dart and JavaScript are both completely dynamically typed.

V8 VM optimized for that (type dynamics).

Dart VM has a lot problem with performance with this dynamics because Dart VM is a truly object-oriented VM and each value has its own type (including a user defined types and a lot types in the Dart SDK, also internal witt hidden implementation, and all their members).

About "blacklists" and "whitelists".

===================================

Method recognizer and [while/black]list

VM: Improve performance of method recognizer and unify the it with the intrinsifier.

https://codereview.chromium.org/468793004/

===================================

https://github.com/dart-lang/bleeding_edge/blob/master/dart/...

INLINE_WHITE_LIST(SET_IS_ALWAYS_INLINE);

INLINE_BLACK_LIST(SET_IS_NEVER_INLINE);

SET_IS_ALWAYS_INLINE(class_name, function_name, dest, fp)

SET_IS_NEVER_INLINE(class_name, function_name, dest, fp)

===================================

https://github.com/dart-lang/bleeding_edge/blob/master/dart/...

===================================

A lot of (problematic) method in these list. Dart VM code generators and optimizers is unable to optimize usage of them by the Dart VM intelligence.

Hundreds of methods in these lists.

OTHER_RECOGNIZED_LIST(V) over 100 methods

CORE_LIB_INTRINSIC_LIST(V) over 50 methods

CORE_INTEGER_LIB_INTRINSIC_LIST(V) over 30 methods

MATH_LIB_INTRINSIC_LIST(V) 2 methods

TYPED_DATA_LIB_INTRINSIC_LIST(V) over 30 methods

GRAPH_TYPED_DATA_INTRINSICS_LIST(V) 9 methods

GRAPH_CORE_INTRINSICS_LIST(V) 10 methods

INLINE_WHITE_LIST(V) over 60 methods

INLINE_BLACK_LIST(V) 8 methods

POLYMORPHIC_TARGET_LIST(V) about 20 methods

Most of them cannot be optimized due the wrong architecture (which states that the type system is unsound).

Most of them cannot be optimized due the other problems in architecture.

P.S.

All mentions about them are hardcoded (added in special lists by humans) because VM has a problems with performance because it cannot optimize code in some cases due the fact that the normal running mode in Dart VM is an (unchecked) production mode.

Normal mode when (types system unsound) means that Dart VM cannot to guarantee that it has possibility correctly recognize a members (of internally implemented types) that are critical for performance.

Dart VM uses a black list for methods that cannot be optimized by VM intelligence. I cannot say anything about V8. But with optimization in Dart VM not all so good. Dynamic typing in Javascript is a normal behavior (VM optimized for that). Dynamic typing in Dart produce a lot of pitfalls (in the sense of the intelligence of optimization).