General optimization

Hello world!

I have a few questions about genral code optimization, I demonstreate examples below:

(1) is it better to use: for (i = 0; i < Array.length; i ++)

{

Code of...

}

or:

length = Array.length

for (i = 0; i < length; i ++)

{

Code of...

}

(2) is it better to use: for (i = 0; i < NUM; i ++)

{

If (tempArray [i] .property is something)

{

Code of...

}

}

or: for (i = 0; i < NUM; i ++)

{

tempVar = tempArray [i]

If (tempVar.property is something)

{

Code of...

}

}

(3) (may somilar to 2..)  is it better to use: for (i = 0; I < NUM: I ++)

{

table [i] = new object (...)

}

or:                                                             for (i = 0 ; i < NUM : i ++)

{

tempObject = new object (...)

table [i] = tempObject

}

I have more questions like that, but respond to those who should help me get started...

Also, is there aby fomral documentation Adobe concerning these things? I couldn't ' find there... So, if someone could refer to such (if it exists), I'd be grateful.

(Edit: by preformance I mean time to use and them RAM - I develop for mobile so this is crucial)

Thank you!

It's the optimization chapter in a book I wrote:

For loops, While loops loops

The bottom line of fast execution loops in Flash is reversed for loops are the fastest.  If a list stored objects of the same type is required in the loop, a loop reversed using a vector to refer to the list of objects is faster.

All three loops run faster if you use an int for the iteration parameter if you use a uint. All three loops to run faster if you decrement the loop variable, instead of increment.  (Note: If you decrement a variable loop i and use I > = 0 as long as the condition of senior year, you will trigger an infinite loop if i is a uint.)

All three loops run faster if you use a variable or a constant for the terminal condition rather than a property of object or expression.

Tags: Adobe Animate

Similar Questions

  • List of pointers Moveblock

    Hello

    I have a list of memory addresses and use Moveblock to get the values (which is a 640 x 480 arrray 2D in my case). That's just fine until calling Moveblock multiple times (for example using different memory addresses) for all my paintings 2D (120 tables). The problem is that it takes a few tens of ms FRO Labview to generate this 120 X 640 X 480 (when you use a loop that calls Moveblock 120 times). Is it possible to directly call a list of pointers and directly retrieve the corresponding 3D table.
    Best

    Well and where your array of pointers come from? The C code gets just a LabVIEW 3D Board, which is not an array of pointers, but simple a memory table with [column * lines * pages] elements. This is the table that you get after you have copied your array of pointers, which is nowhere to be seen in this code C, with MoveBlock() in a LabVIEW 3D Board. In order to do the same thing you do in LabVIEW with MoveBlock() you must have two parameters, the first being the pointer array (more dimensions 3, C pointers have inherent fixed size information) and the second being the table 3D of LabVIEW, then you must first use LabVIEW memory, from Manager to resize this 3D array handle before starting to copy the data into it using memcpy() or MoveBlock() would be too of work and is only slightly slowever as the best implementations of memcpy().

    Most likely, you won't be able to squezze a lot even if you implement that in memory of C. Copying takes time, if you do enforcement by calling a C function as MoveBlock() of LabVIEW or function as memcpy() in C code. There is a good chance that you can win a little because the LabVIEW diagram code made a few test validation, you can omit in your C code, but it will probably not like some exponential improvement. LabVIEW is implemented in C (++) and generally optimizations where a C programmer will need to spend a little time to get the same level. Of course your particular case of calling external code as MoveBlock() limits the possibility for LabVIEW make a lot of optimization, because he does not know what the code called behind the library node call made (even if you call a function of Manager of LabVIEW here) so it can't do things as the loop place , rescheduling of code and many other things without risking that some unknown to LabVIEW, side effect of the called function would be influenced.

    You think that your LabVIEW code is nothing more than a loop, but it you call in the function MoveBlock and the way you do that which might be important detail that now need us to understand what could be improved. Given that it is such a simple VI I don't understand the reluctance to simply post, but are rather some pseudo-code that you want to do us to complete for you the same thing you did in the LabVIEW code, we don't see.

  • Windows Media Center Scheduler service is not running, even when the value of autostart

    I had some trouble recently getting Windows Media Center to record programs. I did some research and found that Windows Media Center (ehSched) Scheduler Service does not start when I start my computer.
    It IS configured to start automatically.
    When I found that the service has not been started, I have manually started, but would find it himself quit again a few minutes later.
    It of very frustrating and resulted in missing the scheduled recordings.
    The only way to save that program is open the WMC and actually watching the program for the duration of the scheduled recording. (Not good if I'm not home!)

    I am running Windows 7 32 bit SP1 on a laptop of Toshiba Satellite A500.

    Help, please!

    Hi the Flomsat,

    I would say looking at the following thread because it's a question similar to yours:

    I tried all the solutions on this thread. None was able to solve my problem.

    However, I found a fix that MAY have worked (it's only 1 day but so far it looks promising).

    Open Windows Media Center,

    Click on settings-> General-> optimization-> uncheck to "perform an optimization. I never noticed an increase in performance and reliability with it turns out, in fact, now that I think about it, when I turned it on, my Scheduler service started having these problems. It must be able to close the Scheduler to 'optimize '...

    UPDATE *.
    It did NOT work

    I had to reinstall windows to get it working again :(

  • Need help with pictures on iMac re: "Summary", "optimize Mac storage."

    iMac mid 2011 1 TB, 2.7 ghz, i5, 16 GB memory hard drive; and MacBook Air mid 2012 128 MB HDD, 1.7 ghz, i5, memory 4gm, both El Capitan 10.11.5 running

    I use Photos since it was released, although I prefer iPhoto (continue to use it separately for now).  I use the pictures on the iPhone 6 too.

    Program to Photos on the iMac, I selected in the preferences: "iCloud library" and "Original download this Mac" so all of the photos are stored on it as well as in clouds.  The photo in the finder library shows its size - Go 117,24.

    The MacBook Air ("MBA"), in the preferences of pictures, I chose the "iCloud photo library' and ' optimize Mac Storage.

    I didn't not use PhotoStream on each device.

    Also, on the MBA in the preferences of Photos under general, I chose "summarize the pictures" and not selected "copy items to the photo library."  But the library in the finder on the MBA is gb 7.62.

    Question: in the MBA, I click on the photos to see larger, "turning clock" icon in the lower right a few seconds, and when it stops, the image, which is a little blurry at first, it seems obvious, and, I guess that in his condition of full resolution.  So, I think it means that the version full resolution has downloaded to the library of Photos of my MBA, is that correct?  If this is true, in theory, I suppose that the library will grow in size that I continue to click on the photos to see and with a large library in the cloud - 110 + Go - I could fill the hard drive of the MBA, which has only 22 GB of available.

    In the preferences of Photos, it seems not be an option to avoid this problem.  In preferences, iCloud screen, the options are "Download original" - just what it says, or optimize Mac Storage, which stores in the clouds and also "stored on the Mac (MBA) If you have enough storage space."


    Thank you.

    Yes you are right that has downloaded full resolution version when you open a picture.

    It will stay there if you have enough room, but once you start to get low disk space, photos start automatically re-optimization of the uploaded photos as and when necessary.

  • Real-time execution trace toolkit to optimize the Labwindows/CVI code

    Hello

    I am trying to optimize a code in real-time in LabWindows/CVI by minimizing the time of each section of the code is taking and find bottlenecks in the code. I check this time using the real-time execution trace toolkit.

    However, I just found it seems to be a constant error when you use the tool of real-time execution trace.

    When I put the traceviewer 'start' and 'stop' right after the other, I get around shift schedule 9us. It seems that the CPU will in some "idle" after the start of the trace mode, or maybe it's the time of communication or something.

    I'd appreciate it if someone could give me an idea of why this is happening. The time of real-time application window is very limited and I'm trying to minimize the time as much as possible. Even the United States 9 error is difficult to resell.

    I used the following code:

    TraceConfigure (1, 1, 0, 25000, NULL);
    TraceStart ();
    TraceStopAndSend (HOST_ADDRESS);

    and there is a photo in the toolkit of real-time execution trace.

    Thank you.

    Generally, you might be better off picking off the clock at the beginning and end of what you want to track. RTETT my introduce overhead that becomes difficult to quantify... Which is what you probably already see. The debug mode will also implement a ton of overhead. Then... Destemming of the clock in release mode will probably give you you the best estimate.

  • General DAQ system design

    I'm designing a new data acquisition system.  I just need some advice on how to design a system properly to acquire data accurately without too much exaggeration.

    During the event of 100 ms, we would capture four pressure curves (event unique, non-periodic) and voltage of several spikes (indicator time to specific event).  We would use a charge amplifier to amplify the signal from pressure sensors.

    Can someone point me in the direction of some books useful, tips, rules, basic Web sites, theorems, etc. to design a system for the acquisition of data including but not limited to, the following topics?

    Sampling frequency:

    What criteria should be used to determine the frequency of sampling?  As the waveforms will not periodic, I think not that the Nyquist theorem applies.  Are there any general rules in this case?

    Voltage range / Amplification:

    How much I amplify my signals?  Our specifications define a scheduled pressure, the maximum value, maximum pressure, that the system should handle and tolerances.  How many voltage range must be a signal medium or maximum signal?

    Data bits:

    How can I determine how many bits of data (and the distinct values so) I need to acquire the characteristics of my curves of pressure with accuracy?

    Hi Steven,

    I have a few PowerPoint slides (attached) of the hands on Session of the week DAQ last OR that give an overview of these three specific themes.  They were meant to be more than an auxiliary to the presentation, so they do not have too much information, but the images that seem to be always helpful (there are animations so you will have to go through the slides in presentation mode).

    Sampling frequency:

    It really depends on what you're trying to measure.  You're right that Nyquist frequency applies that periodic signals (you won't have aliasing if the signal is not periodic), but the sampling rate is always very important depending on how much you care to characterize the shape of your signal.

    If the signal changes rapidly, you will want to ensure that you are sampling quickly enough to acquire enough samples along the transition to be able to characterise the dash (if this is important to you).  On the other side of things, if you're sampling too slowly, it would be possible to completely miss a pulse if its duration is less than the period of your sample clock.

    Voltage range / Amplification:

    They are definitely together.  To optimize the resolution of the ADC, you want to choose an amplifier that fills the whole range of ADC.  Many DAQ cards have integrated amplifier and provides several beaches available (although in DAQmx the user specifies just coming available they want).

    Bits of data (aka resolution):

    It doesn't tell you the number of discrete levels available that you can represent the entire range of data acquisition card.  However, this value is different from the precision due to the error of gain/offset, nonlinearities in CDA and noise.  If you are interested to determine the accuracy of your measurements (which is quite common), you should check the specs of the device and look for the specification of absolute accuracy.

    So in general, I think that you need to understand what are the exactly your needs before selecting equipment.  Are what information you trying to determine from your curves of pressure?  Is the digital signals voltage just spikes that must be timestamped?  What this timestamp would be compared to?

    Best regards

  • Error - Sorry, a serious error has occurred for the installation of the game Command and Conquer Generals.

    Original title: Command and Conquer Generals error? Some one care to help?

    So now I'm a little disappointed in how things are going right now.

    I had Command and Conquer Generals before and I used to read. Bug of the game problems are forcing me to remove it. To make things worse, my PC has been infected with malware/spyware that sneak their way inside my C & C Generals App. I did a full scan using Spy Bot Search & Destroy alongside with MalwareBytes Anti-Malware.

    Then, I tried to re - download and installed a CLEAN one. However, when it loads the classic C & C Splash Screen(the loading page that appears before the game turns into a full screen app), another windows appears and displays this:

    "TECHNICAL PROBLEMS".
    "Sorry, a serious error has occurred."

    After the application closes, and happens whenever I start the game.

    Can someone help me?

    I don't know what's happened since she was working before.

    I do weekly maintenance using Auslogics Boost Speed 5 and Systweak Advanced System Optimizer 3.

    System Specs:
    Microsoft Windows XP SP3
    Intel Pentium IV CPU 2.00 GHZ
    256 RAM
    Radeon 7000 / Radeon VE Family (Microsoft Corporation)

    Every effort to answer my question will be much, much, much appreciated!

    I'll make sure that you have all the patches that are underway for the game Command and Conquer Generals.
    http://www.GameSpot.com/PC/strategy/commandconquergenerals/downloads.html

    If you have access to a library and a flash drive, you can download Microsoft Security Essentials or any other antivirus disk analysis software and then install on your computer even if you do not have access to the internet.
    This will help make sure that you have cleaned your computer properly.

    A system restore back to a point in time so if you have installed all new programs since the date of the restoration of the system, you won't have any more of these programs installed.

    I don't know any other software in system restore, but you can do a search on the internet, however, they can only restore from when their software is installed.

    I hope this helps.

  • How to get into Backgammon after the message "General error"?

    I'm registered, I chose the version computer game, standard, game, then display 'General error', 'try to reload. No way to reload that AFAIK. How can I make it work. I turned off blocking.

    Hi CarolCaseZO,
     
    1. When you say Backgammon are you referring to an online game?
    2. when exactly you get this error message?
    3. were there any changes made to the computer before the question?
    4. what browser do you use?
    5. If you use Internet Explore version of Internet explore you use?
     
    Find out what version of Internet Explorer you are using
     
     
    Check out the link mentioned below, if you are using Internet explorer.
     
    The problems of games online using Internet Explorer
     
    Note: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.
    For reference:
    How to optimize Internet Explorer
    http://support.Microsoft.com/kb/936213/no
    Note: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.
    Method 2:
    If the problem persists, I suggest that you post your request in the community of MSN games, for further assistance:
    http://zone.MSN.com/en/General/article/community.htm
     
    Post a screenshot of this question on this forum so that we can understand the question in a better way.
    How i: post a screen shot on this forum?
     
    Hope this information helps.
  • XP Pro virtual memory optimization: Flash Drive & disc?

    I have a question - several actually, on win XP Pro virtual memory optimization when using both/either SATA hard drive and USB Flash drive.

    I read http://support.microsoft.com/kb/308417 and a few other resources around the web forum, but don't see any true geniuses answers about what measures lead to high performance.
    I understand about the benefits of min and max, but what kind of division, if any, should be used?
    the particular system with what I experience is a laptop presario that has "fast" USB 2 and SATA 150 drive interface using a typical disk of 80 GB at 5400 RPM.
    Max transfer through this channel sata speed is much higher on paper than USB, but of course that is not the whole story.  and the usb flash drives themselves vary considerably in their performance in practice.  I don't know, for example, if, given the two devices as memory virtual stores, it's better to spread the load between the two [I have a concept/model in mind raid] or to bias the allocation manually for the flash/RAM?  It is best to let windows manage the space or is the virtual memory model for XP too primitive to make a good job of determining how to use what device?
    Thanks for any help
    TWest

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the public on the TechNet site. Please post your question in the below link:

    http://social.technet.Microsoft.com/forums/en/category/windowsxpitpro

  • Problems with the keyboard and general performance

    The letter keys must be supported for 3-4 seconds to answer; keys respond instantly.  In addition, the General performance of very slow machine. the file ~ 1 minute.

    At preeviously and has been traced to accidental activation of the sticky keys, which is not active currentlyi.

    Hello

    ·        Using a cable or a wireless keyboard?

    ·        Have you tried to connect another keyboard and checked if it works?

    Method 1:

    Step 1:

    If you use a Microsoft keyboard, you can update the software and check if that helps.

    http://www.Microsoft.com/hardware/download/download.aspx?category=MK

    For keyboard problems, you can follow the suggestions in the below given links and check if this is useful to solve the problem.

    http://support.Microsoft.com/kb/258826

    http://support.Microsoft.com/kb/838398

    Step 2:

    You can check in safemode, if the problem persists. To start in safe mode follow the link given below.

    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    Method 2:

    To improve the performance of Windows, you can follow the suggestions in the below given links.

    http://www.Microsoft.com/athome/Setup/optimize.aspx
    http://www.Microsoft.com/windowsxp/using/Setup/personalize/performance.mspx

    Hope this information is useful.

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • RDP to a Citrix customer... optimize redraws them?

    We are a non-profit health with thin Clinets RDPing on each Terminal Server 1) with access to the Citrix client in a Citrix or PC server 2) with access to the client in a Citrix Citrix server

    Refresh or refresh rate is slow and the connections seems slow through this method... How can we optimize this solution? I'll take everything you have...

    Branch of the law

    IT Director

    E-mail address is removed from the privacy *.

    Hi, William Branch,.

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the TechNet Windows Server Remote Desktop Services forum.

    http://social.technet.Microsoft.com/forums/en-us/winserverTS/threads

    Aziz Nadeem - Microsoft Support

    [If this post was helpful, please click the button "Vote as helpful" (green triangle). If it can help solve your problem, click on the button 'Propose as answer' or 'mark as answer '. [By proposing / marking a post as answer or useful you help others find the answer more quickly.]

  • Advance Registry Optimizer 2010 is installed but does not download it

    aro2010 appeared on my desk and has been downloaded not by me.  It is said that it is locked.  Can I use unlock?  It was created on 09/19/10.  This set for a week my computer is slow and my email one sort of spam or virus to many people in my repertoire.  All problems could be linked to this aro2010?

    Hello

    Advanced Registry Optimizer 2010 is itself probably malware, a program of poor quality if not
    an out right scam you to pay while it offers little or no benefits at all.

    ---------------------------------------------------------------------------------------------------------

    If you need search malware here's my recommendations - they will allow you to
    scrutiny and the withdrawal without ending up with a load of spyware programs running
    resident who can cause as many questions as the malware and may be more difficult to detect as the
    cause.

    No one program cannot be used to detect and remove any malware. Added that often easy
    to detect malicious software often comes with a much harder to detect and remove the payload. Then
    its best to be thorough than paying the high price later now too. Check with them to one
    extreme overkill point and then run the cleaning only when you are sure that the system is clean.

    It can be made repeatedly in Mode safe - F8 tap that you start, however, you must also run
    the regular windows when you can.

    Download malwarebytes and scan with it, run MRT and add Prevx to be sure that he is gone.
    (If Rootkits run UnHackMe)

    Download - SAVE - go to where you put it-right on - click RUN AS ADMIN

    Malwarebytes - free
    http://www.Malwarebytes.org/

    Run the malware removal tool from Microsoft

    Start - type in the search box-> find MRT top - right on - click RUN AS ADMIN.

    You should get this tool and its updates via Windows updates - if necessary, you can
    Download it here.

    Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
    (Then run MRT as shown above.)

    Microsoft Malicious - 32-bit removal tool
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=AD724AE0-E72D-4F54-9AB3-75B8EB148356&displaylang=en

    Microsoft Malicious removal tool - 64 bit
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=585D2BDE-367F-495e-94E7-6349F4EFFC74&displaylang=en

    also install Prevx to be sure that it is all gone.

    Download - SAVE - go to where you put it-right on - click RUN AS ADMIN

    Prevx - Home - free - small, fast, exceptional CLOUD protection, working with others
    security programs. It is a single scanner, VERY EFFICIENT, if it finds something to come back
    here or use Google to see how to remove.
    http://www.prevx.com/   <-->
    http://info.prevx.com/downloadcsi.asp  <-->

    Choice of PCmag editor - Prevx-
    http://www.PCMag.com/Article2/0, 2817,2346862,00.asp

    Try the demo version of Hitman Pro:

    Hitman Pro is a second scanner reviews, designed to save your computer from malicious software
    (viruses, Trojans, rootkits, etc.). who infected your computer despite safe
    what you have done (such as antivirus, firewall, etc.).
    http://www.SurfRight.nl/en/hitmanpro

    --------------------------------------------------------

    If necessary here are some free online scanners to help the

    http://www.eset.com/onlinescan/

    New Vista and Windows 7 version
    http://OneCare.live.com/site/en-us/Center/whatsnew.htm

    Original version
    http://OneCare.live.com/site/en-us/default.htm

    http://www.Kaspersky.com/virusscanner

    Other tests free online
    http://www.Google.com/search?hl=en&source=HP&q=antivirus+free+online+scan&AQ=f&OQ=&AQI=G1

    --------------------------------------------------------

    Also follow these steps for the General corruption of cleaning and repair/replace damaged/missing
    system files.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type this into the search-> find COMMAND to top box and RIGHT CLICK-
    RUN AS ADMIN

    Enter this at the command prompt - sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker
    (SFC.exe) program generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Run checkdisk - schedule it to run at the next startup, then apply OK then restart your way.

    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

    -----------------------------------------------------------------------

    If we find Rootkits use this thread and other suggestions. (Run UnHackMe)

    http://social.answers.Microsoft.com/forums/en-us/InternetExplorer/thread/a8f665f0-C793-441A-a5b9-54b7e1e7a5a4/

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • query optimization

    Hello guys,.

    I made a request, but the execution time is too long, could you help me optimize it please?

    Kind regards

    Try to change your return type of the object root for virtual machines, VMWVirtualMachine.

    and the path to the reference of the root to VMWModel, virtualCenters, virtualMachineCollection, virtualMachines

    A property on or below the return object would then be your path to the where clause.

    There is no end to subject to return anything below VMWVirtualMachine, unless you create 1 line per object in a relationship 1 - several with the object root, such as processors or logical disks.

    In this case, the path in which the comparison of the clause is triggering additional works useless back up the tree view of the object of return, which can work, but not very efficiently in large environments.

    Note that aggregations will cause some performance issues with large sets of data, and how they are created can alter performance.  Always test the performance first without filter or aggregation, then add filters, then add aggregations.

    Aggregations are generally limited in capabilities in queries, in any case.  In general, I remove the aggregation, make the filter here, then the output power to a WCF service to the aggregation (s) the need.

  • Optimize this folder in Windows 7

    What follows average/do in Win 7/64 is a advantage,
    Optimize this folder for: music, videos, Documents, photos, general Articles

    It does not affect play.  It is simply by changing how Windows Explorer presents information for you.

    If you set your TV folder as a type of video file, you can then configure the folder how you like [for example, I always include length, frame height, width of frame in Details view columns] & can then go to organize, file & search options, display tab & click "Apply to folders" to automatically set all records videos for the same parameters.

    Similarly, you can make a record a music folder, set up how you want then set all the other music files are the same.

  • I need free cleanser to clean and optimize my pc

    I need free software for cleaner to clean and optimize my pc for high performance. of sage180

    In general, nothing special.  Windows 7 automatically defragments the hard disk according to the needs / in off-peak period so you do not need to do. You must uninstall the programs, you need or want.  In the contrary case, common sense will keep your computer works well.

Maybe you are looking for