Code Monkey home page Code Monkey logo

barista2's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

barista2's Issues

Can't build inferno benchmark

I did npm install but when I do npm run build I get tons of TS compiler errors complaining about missing inferno module

bin/build_benchmarks.dart does not work

First it tries to copy not-existant util.js. Then it tries to zip a file that does not exist gzip: can't stat: giant.asm.js (giant.asm.js): No such file or directory

RenderNode objects are leaking

diff --git a/api.cpp b/api.cpp
index d09e275..ff22fe7 100644
--- a/api.cpp
+++ b/api.cpp
@@ -30,7 +30,9 @@ bool _canUpdate(shared_ptr<RenderNode> node, shared_ptr<Node> configuration) {
   return node->GetConfiguration()->GetKey() == configuration->GetKey();
 }
 
-RenderNode::RenderNode(shared_ptr<Tree> tree) : _tree(tree) { }
+int RenderNode::__nodes = 0;
+
+RenderNode::RenderNode(shared_ptr<Tree> tree) : _tree(tree) { __nodes++; }
 
 void RenderNode::Update(shared_ptr<Node> newConfiguration, ElementUpdate& update) {
   assert(newConfiguration != nullptr);
diff --git a/api.h b/api.h
index 1d0567b..5f9c755 100644
--- a/api.h
+++ b/api.h
@@ -37,6 +37,7 @@ class Event;
 class Node {
  public:
   Node() { }
+
   virtual string GetKey() { return _key; }
   virtual void SetKey(string key) { _key = key; }
   virtual shared_ptr<RenderNode> Instantiate(shared_ptr<Tree> t) = 0;
@@ -49,6 +50,10 @@ typedef function<void(shared_ptr<RenderNode>)> RenderNodeVisitor;
 
 class RenderNode {
  public:
+  static int __nodes;
+
+  virtual ~RenderNode() { __nodes--; }
+
   RenderNode(shared_ptr<Tree> tree);
   virtual shared_ptr<Node> GetConfiguration() { return _configuration; }
   virtual shared_ptr<RenderParent> GetParent() { return _parent.lock(); }
diff --git a/test_giant.cpp b/test_giant.cpp
index 91fb48a..8340d60 100644
--- a/test_giant.cpp
+++ b/test_giant.cpp
@@ -56,6 +56,7 @@ TEST(TestBootstrapGiantApp)
     auto after_flip = system_clock::now();
     duration<double> delta = after_flip - before_flip;
     cout << "Flip #" << flip << " took: " << delta.count() * 1000 << "ms; tree size: " << html.size() << " chars" << endl;
+    cout << "Node: " << RenderNode::__nodes << endl;
   }
 END_TEST
 

apply patch and see:

$ ./test_giant
Start tests
=============================================
TestBootstrapGiantApp
In main 1490799706085
Bootstrap time: 9.201ms; tree size: 89113 chars
Flip #1 took: 0.025ms; tree size: 35 chars
Node: 1834
Flip #2 took: 7.679ms; tree size: 89218 chars
Node: 3666
Flip #3 took: 0.01ms; tree size: 35 chars
Node: 3666
Flip #4 took: 8.058ms; tree size: 89235 chars
Node: 5498
Flip #5 took: 0.025ms; tree size: 35 chars
Node: 5498
Flip #6 took: 8.494ms; tree size: 89235 chars
Node: 7330
Flip #7 took: 0.014ms; tree size: 35 chars
Node: 7330
Flip #8 took: 7.345ms; tree size: 89235 chars
Node: 9162
Flip #9 took: 0.011ms; tree size: 35 chars
Node: 9162
Flip #10 took: 8.16ms; tree size: 89235 chars
Node: 10994
Success
End tests

Do detached children leak memory due to parent/child cycle

Reported by @mraleph. Reading the code, there should be a memory leak when detaching a sub-tree of RenderNodes. Despite Detach() nulling out _parent for the top-most detached child, the cycles inside the sub-tree should still prevent the destructors from being called. A quick speculative fix is to override Detach() in RenderMultiChildParent and call Detach() recursively on all live children.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.