question

Lucas Klein avatar image
0 Likes"
Lucas Klein asked Lucas Klein commented

FlexScript and DLL

Dear all,

As suggested by @phil.bobo I am coming to this topic to detail a question that I had with the use of DLL and performance of the model. Follow attached a .zip archive that contains two simple models to represent the model I was working on. One of them uses DLL and the other does use FlexScript code.

In this model I constantly call a user event (0.2 second repeat time) that colors an object in my model, the DLL have exactly the same code that is in the User Event Script of the "not-DLL model". According with some tests made, the DLL had a slower execution than FlexScript. Follow attached also in this zip a few prints showing the execution time of the codes in FlexScript Code Profiling and also by a realTime execution, the realTime code was hand developed to measure time and is inside the Model Triggers "OnRunStart" and "OnRunStop"

dll-test.rar

FlexSim 16.0.8
flexscriptdll
dll-test.rar (485.9 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Phil BoBo avatar image
3 Likes"
Phil BoBo answered Lucas Klein commented

If you build the DLL in release mode, then the execution is faster with the DLL.

Results on my computer:

In 16.0.8, 4 seconds with the Release Mode DLL, 6 seconds with FlexScript, and 10 seconds with the Debug DLL.

In 17.0.3, 4 seconds with the Release Mode DLL, 4 seconds with FlexScript, and 10 seconds with the Debug DLL.

Also, the size of the DLL shrinks from 1,199 KB to 215 KB when you build in Release Mode rather than Debug Mode.


release-mode.png (98.4 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Lucas Klein avatar image Lucas Klein commented ·

Thanks @phil.bobo it worked here. Good to know about those differences between building with Debug and Release.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.