JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Unfolder V2, stress test on FF and Chrome

    Scheduled Pinned Locked Moved Comments & Feedback
    10 Posts 2 Posters 3.6k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gilboonetG Offline
      gilboonet
      last edited by gilboonet

      Hello, I tested the unfolder V2 on Ubuntu with Firefox and Chrome, on my laptop (APU with 4 cpu and 8 Gb RAM) and my desktop (2 CPU with 8 Gb + GPU with 1 GB).

      1000 faces model :

      • 17 sec. on the laptop with Chrome
      • 31 sec. on the laptop with Firefox
      • 1'37 sec on the desktop with Firefox

      2000 faces model :

      • crash on the laptop with Chrome
      • 1'00 sec on the laptop with Firefox

      Apparently, there's a memory leak somewhere, but I don't know how I can release memory or if it is needed.

      hrgdavorH 3 Replies Last reply Reply Quote 0
      • hrgdavorH Offline
        hrgdavor @gilboonet
        last edited by

        @gilboonet JS uses a garbage collector, so to release memory you need to remove references to objects.

        One advanced trick when caching stuff is using WakMap https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap . This is a familiar concept to me from Java. It allows you to cache some heavy calculations but also allows garbage collector to delete them.

        Initial versions of garbage collectors counted references and when counter is zero they clean the mem. Then they added a concept of weak references where, you could reference something weakly, but allow garbage collector to clear it if RAM is needed.

        chrome dev tools has a nice profiler, probably firefox too, and you could use that to see where most of RAM is spent.

        gilboonetG 1 Reply Last reply Reply Quote 0
        • gilboonetG Offline
          gilboonet @hrgdavor
          last edited by

          @hrgdavor Thanks for the info, I will try to remove references to my objects.

          1 Reply Last reply Reply Quote 0
          • gilboonetG Offline
            gilboonet
            last edited by gilboonet

            @hrgdavor Hello, I revised my code, and I it seems to be compatible with js garbage collection. Chrome's crash happens after I my code after my main return and it's not a matter of memory, when it happens 40% of RAM is free.

            Capture d’écran de 2022-02-04 16-57-52.png
            There is maybe a memory limit for Chrome on jscad rendering ? There's maybe an issue on my code because for the model that crashes Chrome, Firefox renders pages with overflowed faces which should not happen.

            I just tried a 3000 faces model with Firefox, it renders in 2 minutes but hangs and never stops, debugger says "uncaught out of memory".

            Capture d’écran de 2022-02-04 20-54-49.png

            1 Reply Last reply Reply Quote 0
            • hrgdavorH Offline
              hrgdavor @gilboonet
              last edited by

              @gilboonet those can be tricky to debug. One thing I am thinking is if you really need 3000 faces. Is that practical to actually make ?

              Also issue could be in the code that sends your data to WEBGL.

              can you try to run it inside:
              http://3d.hrg.hr/jscad/three/threejscad2.html
              ?

              gilboonetG 2 Replies Last reply Reply Quote 0
              • gilboonetG Offline
                gilboonet @hrgdavor
                last edited by

                @hrgdavor I will try to run it on you link this week-end. For the moment my most detailed model has 2000 faces and I hope to start build more detailed, but it's already more than most papercraft models.

                1 Reply Last reply Reply Quote 0
                • gilboonetG Offline
                  gilboonet @hrgdavor
                  last edited by gilboonet

                  @hrgdavor I made a custom version including the 3000 faces model to run it with your threejsjscad2 and it works on both Firefox and Chrome, very quickly, a few seconds on Firefox and faster on Chrome, which is very nice. But as there's no 2d output it can not be used. Anyway it could help find what makes jscad 2 slow.
                  Capture d’écran de 2022-02-05 10-23-48.png
                  Capture d’écran de 2022-02-05 10-33-25.png

                  1 Reply Last reply Reply Quote 0
                  • hrgdavorH Offline
                    hrgdavor @gilboonet
                    last edited by

                    @gilboonet that is great news. the performance gain will be available in new jscad prototype too....
                    I could add 2d output to threejscad2 ...

                    gilboonetG 1 Reply Last reply Reply Quote 0
                    • gilboonetG Offline
                      gilboonet @hrgdavor
                      last edited by

                      @hrgdavor As there was nothing more I could do to improve this V2 version of the Unfolder, I started a simple JS version and it works really fine : unfolding is immediate even for 3000 faces model, and output to pdf works.
                      Capture d’écran de 2022-02-13 18-27-01.png

                      hrgdavorH 1 Reply Last reply Reply Quote 0
                      • hrgdavorH Offline
                        hrgdavor @gilboonet
                        last edited by

                        @gilboonet that is excellent, it may be possible later on to integrate that one with jscad or at least take your experience for ideas how to improve 2D use-cases in jscad.

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • First post
                          Last post
                        Powered by NodeBB | Contributors