G#

cancel
Showing results for 
Search instead for 
Did you mean: 

Performance for Creating Objects

So of late I have been trying to convert the Gold Parser Engine into labview. However after looking at the code and seeing how dependent on pointers it is I decided to use the G# Framework. And after a while i got it to work, yes there is a few bugs i still need to work out. But one concern is the performance of G# when creating many objects. LRActions and such which there are thousands of in a fairly simple grammer. And strings Since labview doesnt support UTF16.

However I see to be running into performance issues when creating large number of objects quickly. The Visual basic version loaded the file in about 15ms but the G# version is running around 1000ms not that this is at all the fault of G# and not somewhat my fault. but I did notices that G#Object.lvclass:GetClassName spend a good amount of time on calls. Perhaps I need to do some restructureing or some type of refactoring.

G#Performance.png

I did look at the performance Examples and try to make as few copies for large objects as possible.

0 Kudos
Message 1 of 4
(7,005 Views)

You have an average of 0ms, but if you could share the code we can analyze and test. Fixing bottlenecks is always important.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 4
(5,683 Views)

Why Not ?

https://decibel.ni.com/content/docs/DOC-41064

Please let me know if you can find the performance issue. Its under Parser LoadTables i have it setup to run by itself currently. (1/15/2015)

You'll need a EGT to try it. Here is one I've been using.

0 Kudos
Message 3 of 4
(5,683 Views)

Hi,

I had a look at this problem in general and made some improvments to the G#Object.lvclass:

* Improved performance in GetClassName.vi by caching last result and use the same answer if needed.

* Performance improvement in NewObject. No need to check if external process is running when "no registration" is checked.

We will include these in the next release. Please notice that I have not tried this on your code.

You may also want to try the "No registration" boolean input of the G#Object_New.vi inside your constructor, this is default set to false, but if you set this to true, performance will be increase about a factor 2, but you will not see the object with the G#Debugger or can't use the G# Garbage Collector.

With the new improvements (with No registration = true), my test class of 10000 objects was created in 800 ms, compare to 2875 ms with the old implementation (with No registration = false). Please let us know the results.

If you just have one class that you would like to create many objects with high performance from just to represent some datastructure, I would perhaps recommend to use not a G# class, but perhaps just a standard LabVIEW class with a DVR inside or a queue directly. Since G# is not native LabVIEW syntax, there will always be performance compromises compared to tracking the objects, but I see no problem combining G# classes with other "class" implementation where needed. I've done this myself many times.

Please replace your:

C:\Program Files (x86)\National Instruments\LabVIEW <version>\vi.lib\addons\_AddQ\G#Object

with the one attached. Please notice this code is LV2010.

Thanks,

Mattias

Message 4 of 4
(5,683 Views)