Performance of vectorMath.createPoint

Next
 From:  guschard
9831.1 
Hi,

I made a simple script initializing 3.000 points, and it takes around 5 seconds to execute. As I'm only initializing the points, I would expect it to take just a few miliseconds. Why does that happen?? Is there a overhead in calling the moi.vectorMath.createPoint function?? If so, is there any way to initialize a list of points at once??

The code is pretty simple, so I'll post it here;

var t0 = new Date();
var n = 3000;

for(var k = 0; k <= n; k++)
var pt = moi.vectorMath.createPoint(0, 0, 0);

var t1 = new Date();
moi.ui.commandUI.alert((t1 - t0).toString());

Thank you very much
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9831.2 In reply to 9831.1 
Hi guschard, what version of MoI are you using?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9831.3 In reply to 9831.1 
There is a big difference between v3 and v4 with this - for v3 the script is running in a separate process (moi_commandprocessor.exe) and there is interprocess communication overhead with every object access. However, this loose coupling allows for interrupting the script at any time.

It's different in MoI v4, in v4 the script is executed within the same main MoI.exe process and so there is a lot less overhead.

So if you were using v3 the first thing to try is to test it with v4.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  guschard
9831.4 In reply to 9831.3 
Hummmmmm, understood. I'm using V3, but I'll take a look at V4.

Thank you very much!!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  wayne hill (WAYNEHILL5202)
9831.5 
In the node editor: About 53ms to create 3000 points.

Added comments to the PointTest.js node file incase other users are interested in a simple node creation process.

- Wayne



EDITED: 17 Jan 2021 by WAYNEHILL5202

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All