Does anybody know the size and performance overhea...
# javascript
m
Does anybody know the size and performance overhead of classes in K/JS? I wonder if it’s okay to have hundreds of small interfaces and classes or if that will increase bundle size or decrease performance noticeably.
s
For example, this
Copy code
interface I
class A : I
compiles down to
Copy code
function I() {
  }
  I.$metadata$ = {
    kind: Kind_INTERFACE,
    simpleName: 'I',
    interfaces: []
  };
  function A() {
  }
  A.$metadata$ = {
    kind: Kind_CLASS,
    simpleName: 'A',
    interfaces: [I]
  };
As you can see there is a small overhead of
$metadata$
property per class and interface, which might increase bundle size and module initialization time. However, runtime performance is unaffected and similar to ES6 classes compiled down to ES5.
👍 1
m
Thank you @Svyatoslav Kuzmich [JB] that’s very good to know.