Magik Performance

There is a database performance page located at db-perf

Help to Determine Performance Issues (4.x)

You can use xprf and xprf_dialog to help identify performance problems. You can get an xprf results in several ways:

  • new_when_send will return xprf the next time the method is called.
  • new_from_call runs the given proc
  • new_from_send runs the given method on the exemplar.

If you get a stack_overflow traceback, increase the light_thread.vm_max_depth. Not sure the memory ramifications of increasing this. Example:

light_thread.vm_max_depth << 8192

Constant vs. is_kind_of?()

You will note the shared constant is much quicker (note the loop amount, 1 million for is_kind of vs 10 million for constant). But, it is really only quicker if you are running the test more then 1 million times. So if you are only calling the test occasionally, then it probably isn't worth having a constant on the exemplars.

is_kind_of? vs rwo_type

is_kind_of? vs inherits_from?

Note from Roger Fretwell: 'is_kind_of?' performs worse the deeper the inheritance tree of an object, and also for RWOs a much faster alternative is to use 'rwo_type', or in PNI 'is_type_of?()'.

Not much difference at the 100000 times. but if you need that little extra… Use inherits_from?. Use is_kind_of? for less then 1000 iterations.

Sorted_collection vs. Equality_rope

Use sorted collections over equality testing for IDs.

Equality Property List vs as_symbol()

Use Equality Property List.

Database Notifications

This could be in the database section, but it is done thru magik, so I put it here. In 4.2 (maybe 4.1) Smallworld introduced the ability to turn off database notifications. This seems to help prevent the database update from triggering all the dependent plugins from running when you are doing bulk modifications. To use:

    _dynamic !notify_database_data_changes?! << _false 
    # Your code here
    # You need to trigger the changes yourself at the end

There is another system in place if the above code doesn't help.

#... load all ...
view.restore_notification(_false) # use true if you want notifications to be sent at end.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License