realbasic-nug
[Top] [All Lists]

FR: Change UBound from a member function to instead access the internal

To: "REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>" <realbasic-nug at lists dot realsoftware dot com>
Subject: FR: Change UBound from a member function to instead access the internal array counter value directly (read-only)
From: Daniel Stenning <d0stenning at msn dot com>
Date: Thu, 17 May 2007 17:11:01 +0100
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Thread-index: AceYnfYhNKZxpgSREdyC5AAKldQmeg==
Thread-topic: FR: Change UBound from a member function to instead access the internal array counter value directly (read-only)
Ok - to settle this age old issue once for all.... :)

http://www.realsoftware.com/feedback/viewreport.php?reportid=umcympop

in order to get the best performance, it is common to use:

dim U as integer = myArray.UBound
for i as integer to U
...
Next

instead of:

for i as integer to myArray.UBound
...
Next

( which is much cleaner )

It would be helpful if there were NO performance penalty in using the latter
syntax. If the compiler could just refer to the internal array size count
directly without any function call overhead, we would get this, and I could
use the latter syntax "performance guilt free" :)

(This assumes of course that INTERNALLY RB maintains such a variable that
gets updated whenever elements are added/removed)


Sign on here:

http://www.realsoftware.com/feedback/viewreport.php?reportid=umcympop


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>
  • FR: Change UBound from a member function to instead access the internal array counter value directly (read-only), Daniel Stenning <=