PowerShell - what is the most efficient/fastest way to find an object in an arraylist

Hi
I Work with a lot of array lists in PowerShell when working as a sharepoint administrator. I first used arrays but found them slow and jumped over to array lists.
Often i want to find a specific object in the array list, but the respons-time varies a lot. Does anyone have code for doing this the most efficient way?
Hope for some answers:-)
brgs
Bjorn

Often i want to find a specific object in the array list, but the respons-time varies a lot. Does anyone have code for doing this the most efficient way?
As you decided to use an ArrayList, you must keep your collection sorted, and then use the method BinarySearch() to find the objects your looking for.
Consider using a dictionary, and if your objects are string type, then a StringDictionary.
You stil fail to understand that he slowness is no in the arraylist.  It is in the creating of the arraylist which is completely unnecessary.  Set up a SharePoint servefr and create a very large list and test..  You will see. An arraylist
with 10000 items takes forever to create. A simple SharePoint search can be done in a few milliseconds.
Once created the lookup in any collection is dependent on the structure of the key and the type of collection.  A string key can be slow if it is a long key.
The same rules apply to general database searches against an index.
The main point here is that SharePoint IS a database and searching it as a database is the fastesst method.
Prove me wrong devil!    Submit!  Back to your cage! Fie on thee!
¯\_(ツ)_/¯
You seem to be making a lot of assumptions about what he's doing with those arraylists that doesn't seem justified based on no more information than there is in the posted question.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • What's the most efficient way to serve a file from a servlet?

    I have a servlet that does various different things depending on the needs. Sometimes it dynamically generates content, and sometimes all it does is send a file out, with no alteration.
    What is the most efficient way to just send a file?
    One option:
    OutputStream os = response.getOutputStream();
    InputStream is = new FileInputStream(...)
    (send all the bytes from is to os, the regular way using a buffer)Another option is to say:
    RequestDispatcher rd = response.getRequestDispatcher(fileName);
    rd.forward();Any other options? What's the prefered way of doing this?
    I know the rule of "don't optimize too early" but this is a situation where we need to get the maximum amount of files served with the hardware we have, and it's going to be a lot of static files, so efficiency is important.
    Thanks

    Ok, that's what I thought. It would be nice if there were a "response.sendStream(InputStream input)" method in the ServletResponse class. Even nicer would be a sendFile or sendChannel or something. This is probably a common usage and it's a place where the container has many opportunities for optimization. For example, it could call the operating systems send_file kernel call so the entire transfer would be done directly from the disk controller to the ether card (on systems that support that).
    For now I'll just do my own buffered copy.

  • I am giving my old MacBook Air to my granddaughter.  What is the most efficient way to erase all the data on it?

    I am giving my old MacBook Air to my granddaughter.  What is the most efficient way to erase the data?

    You have two options.....
    One is to do a clean reinstall of your OS - if you still have the USB installer that came with your Macbook Air...
    The second option is to create a new user (your granddaugher's name).....Deauthorize your Macbook Air from your Itunes and Appstore.....
    Restart your Macbook after you've created your granddaughter's user name, login under your granddaughter's username and delete your username.
    Search your Macbook for your old files and delete them.....
    Good luck...

  • What is the most efficient way to have full access to the front panel on RT Labview?

    I have a RT machine that needs to do its job and also port the front panel to an external machine over the network. What is the most efficient way to do it? Using as little of the RT time as possible but providing full functionality to the RT front panel.
    So far I have been using it directly from Labview - running the VI on a remote (RT) and have the front panel on local Labview (WINDOWS). I know I can do it with also through WWW (not very happy with that though).
    LV2009 SP1.
    Thanks

    Running a compiled executable on the RT target, rather than running it within the development environment, is probably slightly more efficient but limits you to the web interface.  If you're running within the LabVIEW environment, I doubt there's a noticeable difference in efficiency from the RT perspective between the web server and the LabVIEW front panel, although that's mostly a guess (I would expect the RT system to send identical data in each case, once the front panel is loaded).  Those are your only options in modern LabVIEW versions.  In LabVIEW 7.1 you could build an executable that acted as the front panel for an RT system, but that feature does not exist in recent versions.  However, a quick search turned up this document with code to approximately duplicate that behavior, perhaps it will work for you?

  • What is the most efficient way to convert a static site to a responsive site using Dreamweaver?

    I need to convert an old site made in Dreamweaver to be responsive to any monitor size. What is the most efficient way to do this?

    Depending on what you have to work with and how it was coded, it might be doable and then again not.  Suffice it to say, there are no magic buttons that will do this for you. Also consider that mobile & tablet users interact differently with their web devices. So your navigation & forms must be finger friendly.  Also images & content must make mobile users happy without killing their dataplans.  There's a lot of planning that goes into making a good Responsive Web site.
    Nancy O.

  • What is the most efficient way to turn an array of 16 bit unsigned integers into an ASCII string such that...?

    What is the most efficient way to turn a one dimensional array of 16 bit unsigned integers into an ASCII string such that the low byte of the integer is first, then the high byte, then two bytes of hex "00" (that is to say, two null characters in a row)?
    My method seems somewhat ad hoc. I take the number, split it, then interleave it with 2 arrays of 4095 bytes. Easy enough, but it depends on all of these files being exactly 16380 bytes, which theoretically they should be.
    The size of the array is known. However, if it were not, what would be the best method?
    (And yes, I am trying to read in a file format from another program)

    My method:
    Attachments:
    word_array_to_weird_string.vi ‏18 KB

  • What is the most efficient way to post several stories to multiple html pages

    What is the most efficient way to post five stories to multiple html pages?
    Currently they are all html files saved in DW with some divs sharing content and other divs are unique.
    I've experimented with saving stories as library items and dropping into other html but wondered if there is a more efficient or dynamic process.

    Server-Side Includes.
    http://forums.adobe.com/message/2112460#2112460
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Moving content from iMovie to iMovie - what's the most efficient way?

    If I edit and create movies in iMovie08 on one iMac and I want to transfer the content to iMovie08 another iMac 200 miles away , what's the most efficient way? I prefer not to burn DVDs, because I want to do further work on the movies on the second iMac's iMovie (so I can share them with iTunes and sync them with Apple TV).

    >PDPageAddCosContents(destPage, PDPageGetCosContents(srcPage));
    Does this method (PDPageGetCosContent) exist? It would be easy enough
    to create, but I don't see it in the document.
    More seriously, I have a vague memory that it is a Really Bad Thing to
    share the same Contents objects between multiple pages. Maybe
    something to do with page deletion, can't remember.
    >PDPageAddCosResource(destPage, PDPageGetCosResources(srcPage));
    These two methods are not symmetric, and PDPageAddCosResource doesn't
    work that way, sadly...
    Aandi Inston

  • With OS 10.4.11, what is the most efficient back up system?

    Using OS 10.4.11 on a PowerPc G5, what is the most efficient way to backup?

    Look at Mac Backup - Mac Backup Software, Hardware, and Guides for Your Mac http://macs.about.com/od/usingyourmac/tp/backuphub.htm and  Mac OS X data backup FAQ http://www.macmaps.com/backup.html  and Important Mac Backup Tips- Time Machine, CCC, SuperDuper http://mikosweb.com/it-advice-blog/70-mac-backup-tips Here's a list/description of Mac backup software http://www.pure-mac.com/backup.html
    The majority of Mac users use CarbonCopy Cloner @ http://www.bombich.com/software/ccc.html , or SuperDuper @ http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html . You can also use or the Restore function of Disk Utility included in OS X.
    When you backup, boot into Safe Mode (depress the Shift key at startup) and the backup will be safer and faster.
     Cheers, Tom

  • What is the most cost effective way to have a broken screen repaired?

    What is the most cost effective way to have a broken screen repaired?

    One thing to bear in mind, if your iPad is still under any sort of warranty, using any unauthorized repair place may void that.
    So you may find less expensive places that are non-authorized, but once you use them, Apple disowns your device and if you have any warranty left, it'll be void.

  • HT5192 What is the easiest and fastest way for me to get the iOS 5.1 update for my ipad2?

    What is the easiest and fastest way for me to get the iOS 5.1 update for my ipad2? I am non tech savvy and am a new user to apple devices.

    If you are already running iOS 5 on your iPad go to Setrings>General>aoftware Update and you can update over the air via WiFi. If you are not running iOS 5 you have to connect the iPad to your computer and update via iTunes.
    Instructions here.
    http://support.apple.com/kb/HT4623

  • Hello! I have a MacBookPro5,1. I recently had to erase the disk and start over. So right now I have OS X. what is the best(cheapest/fastest) way to get current on my OS to be able to use current websites and programs? thanks!

    Hello! I have a MacBookPro5,1. I recently had to erase the disk and start over. So right now I have OS X 10.5.5. what is the best(cheapest/fastest) way to get current on my OS to be able to use current websites and programs? thanks!
    Right now there is pretty much nothing on it, and I cant download basic things.

    Upgrading to Snow Leopard
    You can purchase Snow Leopard through the Apple Store: Mac OS X 10.6 Snow Leopard - Apple Store (U.S.). The price is $19.99 plus tax. You will be sent physical media by mail after placing your order.
    After you install Snow Leopard you will have to download and install the Mac OS X 10.6.8 Update Combo v1.1 to update Snow Leopard to 10.6.8 and give you access to the App Store. Access to the App Store enables you to download Mavericks if your computer meets the requirements.
         Snow Leopard General Requirements
           1. Mac computer with an Intel processor
           2. 1GB of memory
           3. 5GB of available disk space
           4. DVD drive for installation
           5. Some features require a compatible Internet service provider;
               fees may apply.
           6. Some features require Apple’s iCloud services; fees and
               terms apply.
    Upgrading to Mavericks
    You can upgrade to Mavericks from Lion or directly from Snow Leopard. Mavericks can be downloaded from the Mac App Store for FREE.
    Upgrading to Mavericks
    To upgrade to Mavericks you must have Snow Leopard 10.6.8 or Lion installed. Download Mavericks from the App Store. Sign in using your Apple ID. Mavericks is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
        OS X Mavericks- System Requirements
          Macs that can be upgraded to OS X Mavericks
             1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
             7. Xserve (Early 2009) - Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
         Are my applications compatible?
             See App Compatibility Table - RoaringApps.

  • What is the most efficient (in terms of cost) way to transfer 35 mm slides to my iMac hard drive?

    What is the most cost efficient way to transfer 35mm slide images to my iMac hard drive?

    This gives you the basics
    http://www.tech-faq.com/how-to-copy-slides-to-disk.htm
    The first option, the professional one, isn't the cheapest - but the results should be good.
    The second option is very appealing. Some printers come with brackets that can be used to scan film or slides.
    The third option is a slide scanner. I haven't used this option, but there's a significant startup cost of under $100.
    In short, a scanner is the cheapest and most efficient option.

  • What is the most efficient way to compare two Lists?

    List A{itemId,itemName} [1,xyz] [9,iyk] [4,iuo] .......
    List B{itemId,item price} [2,999] [9,888] [1, 444].......
    Assume A will be a much larger list than B
    I am trying to find all the items with same itemiId. what would be the most efficient way to do that?
    Thanks!

    Tinkerbell. wrote:
    BigDaddyLoveHandles wrote:
    You wrote:
    Can we assume that an itemId only occurs once in each list? You're the one making claims and assumptions, not me.No in #4 I asked the OP to verify an assumption.An assumption that couldn't possibly be true. Why are you wasting our time?

  • WHAT IS THE MOST EFFICIENT WAY OF ORGANISING DOCUMENT FILING ?

    I know this sounds dumb, but I am flummoxed about how to organise filing of folders on my Mac. In the real world filing is easy but computers seem to make it completely different & a nightmare.
    I have ten years worth of using various macs all copied onto the latest one & now occupying about 230 Gigabytes. There are loads of duplicated files and repeated backups from all those years just sitting around taking up space & making it impossible to find anything.
    Obviously I was careless about filing right from the start, not realising what a mess it would get into.
    In the real world you can just clean up an untidy mess and make it tidy, organised and easy to find things. But in the real world you dont have an electronic lunatic duplicating everthing all the time. With over a million files to look at & sort it is simply impossible to do what you would do in the real world.
    One obvious solution is just to archive it and start again. But this time I would like to know how to stop this happening again and what is the best 'system' or way of organising files to stop it all becoming a total mess again.
    What seems to happen is that my good intentions of having about ten folders on my desktop to cover ten areas of activity naturallly degraded as when you have a busy day you collect all sorts of things on the desktop outside of those folders which you want to just leave on the desktop to deal with and complete another day.
    This process happens every day and so when you then clean up the desktop you just bung all those files in the basic ten folders. But that just means you transfer the mess from the desktop into the ten basic folders and the same process just gets endlessly repeated all the way down through each hierarchical layer of the folders.
    This is obviously a problem everyone has, and some bright spark must have worked out a way of preventing this from happening.
    i.e. someone must have worked out the best way of organising a filing system on a Mac.
    And part of this problem is illustrated by email which I have no idea how to stop getting bigger & bigger.
    The only solution I can think of is to archive my whole desktop on an external disk and start all over again from the begining by setting up a brand new account. But while this would work to start off with, unless I can work out some way of doing things better, it will also eventually become a horrible, cluttered mess.
    Has anyone got any ideaas about how to deal with this problem. It must be a problem for everyone really ?

    Well, there are two sides to this. The first is obviously the organizing of your files, which is something that you really have to work out your own solution for. I don't know what your ten folders are called, but it seems that that's not working for you as a way to keep things managed on a daily basis. What kind of files are these - documents (eg Word files), photos, something else? Do they all need to be filed in folders? (If they're images, there are better ways to manage them - eg iPhoto). Do they all even need to  be kept?
    The other side to this is retrieval. We keep things organized so that we can easily retrieve them. However, the advantage of a computer-based system, above a paper filing system, is that you can have multiple ways of getting to information without having to change the way the files are stored. For example, the Finder can store searches as Smart Folders, meanings that you can search documents for "Tax Return" and store the results in a sidebar shortcut. Any documents containing that text (whether in the title or in the document itself, your choice) will automatically be displayed in that "folder" (although you're not moving files, you're simply displaying the result of a search).
    Similarly, tags in 10.9 Mavericks are designed to let you add keywords to files (such as "Urgent", "Pet Information", "Household", "Financial", and so on), and documents tagged this way are automatically shown collected in the sidebar.
    Email services are moving in the same direction. You *can* spend a period of time every day manually filing email into mailboxes you've created to organize them, but a more efficient method can be to leave them all in one folder (ie, the inbox), tag them appropriately, and then display the tagged results as folders (this is what Gmail does with labels), or search for specific criteria (show me all mail from Bob with attachments, show me all mail that includes the phrase "Project Werewolf".
    If you can figure out a smart retrieval system that works for you, I would recommend that over the manual organization which is currently causing you frustrations. Do some basic organizing, sure - you don't want everything in one huge folder - but don't forget there are tools which are there to help you find things quickly.
    Matt

Maybe you are looking for

  • INDESIGN CS6 will NOT open files!

    INDESIGN CS6 at launch will NOT open ANY documents , freezes on Open. Have tried moving SING Mark II folder- did not fix problem. FYI Indesign CS5.5 is fine. Hardware Overview:   Model Name:          iMac   Model Identifier:          iMac12,2   Proce

  • DBMS_SCHEDULER behavior in a RAC environment

    What is the behavior of DBMS_SCHEDULER in a RAC environment (say 2 nodes, N1 and N2): Is the behavior of a DBMS_SCHEDULER job created using a connection to the RAC service name be the same as if the job were created using a connection to N1 iusing th

  • My yahoo mail get this error Error code: ssl_error_access_denied_alert

    I can get into my yahoo mail account but when i try to go to the calendar i get this error message Error code: ssl_error_access_denied_alert

  • Xl reporter - udf parameter

    hello i have created a report on xl reporter using an udf. however, i would like to create a parameter on the udf and i am not able to do this. is it possible to create a parameter on a udf on an xl report? thanks

  • REF partitioning is affecting on complex queries

    Hi, I am having 7 tables consider A,B,C,D,E,F,G. whereas A is master table and others are dependent on table A. columnA is referential key for all tables. Table A is having one DateRange column. I have successfully created range partitioning with par