Singular https://www.singular.uni-kl.de/forum/ |
|
minimize overhead when returning objects from procedures https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=2294 |
Page 1 of 1 |
Author: | Jack [ Thu Oct 10, 2013 12:35 pm ] |
Post subject: | minimize overhead when returning objects from procedures |
What is a reasonable method in Singular ( less copying, less memory usage footprint ) to return rings and other objects from procedures if there are several calling levels - use return() or - update a passed list reference parameter? or - < put your approach here> |
Author: | hannes [ Fri Oct 11, 2013 11:32 am ] |
Post subject: | Re: minimize overhead when returning objects from procedures |
For usual types: it depends. The time consuming operations are the same in nature and count (clean up the old content, move the new one to the destination) if return is compared to reference. For ring/qring reference should not be used: there are special rules for rings which do not apply for references! If you are looking for the fastest method with minimal memory foot print, the construction of the object as global one may be the best method but this has other negative aspects. |
Author: | Jack [ Mon Oct 14, 2013 3:40 pm ] |
Post subject: | Re: there are special rules for rings |
hannes wrote: For ring/qring reference should not be used: there are special rules for rings which do not apply for references! Could you step a little bit more into detail: which specials rules for rings do not apply when using references? If that is really so bad, could this be prevented by the language itself? Jack |
Author: | hannes [ Tue Oct 15, 2013 9:47 am ] |
Post subject: | Re: minimize overhead when returning objects from procedures |
special rules for ring/qring: - assignment does not copy - nameof(basering) is always a local variable name even if defined in another procedure - if there are several names for the current barering, removing nameof(basering) sets nameof(basering) to one of the others (so nameof(basering is always defind as long as there is any basering) Jack wrote: If that is really so bad, could this be prevented by the language itself? No, it is like converting module to matrix and vice versa: quite useful and sometimes necessary but should not be done too often. Or like shooting yourself in the foot:: sometimes useful, one can still walk, but generally not recommended. And: reference is an experimental feature: it can/will be removed/changed/renamed etc. |
Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |